无法使用crontab运行多线程Python脚本

时间:2017-01-31 22:31:36

标签: python multithreading crontab

我的Ubuntu 14.04上有crontab的问题LTS拒绝运行我的多线程python脚本。 当我手动操作时,我的脚本工作正常:

sudo python my_script.py

但是当我在crontab上安排它时:

21 23 * * * sudo /usr/bin/python /root/my_script.py 2>seo_error2.log

无法正常运行,我对线程有例外:

Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/root/my_script.py", line 152, in consumer
    foo(d, printlock, updatelock) #call our function from before
  File "/root/my_script.py", line 79, in foo
    print "Titre de la page:", titre
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in range(128)

0 个答案:

没有答案