我有以下 cronjob:
0 0 * * * source /home/admin/data/virtualenvs/myapp/bin/activate && python /home/admin/data/virtualenvs/myapp/project/manage.py 1c-import >> /home/admin/data/logs/1c-import.log 2>&1
因此,在日志文件中,我看到以下错误:
Traceback (most recent call last):
File "/home/admin/data/virtualenvs/myapp/project/manage.py", line 28, in <module>
execute_from_command_line(sys.argv)
File "/home/admin/data/virtualenvs/myapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/admin/data/virtualenvs/myapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/admin/data/virtualenvs/myapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/admin/data/virtualenvs/myapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/home/admin/data/virtualenvs/myapp/project/helper/management/commands/1c-import.py", line 94, in handle
print 'Product [%s] with price %s and qty %s' % (product_title, product_price, product_qty)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 34-35: ordinal not in range(128)
但是当我尝试手动运行这个命令时 - 没关系。你怎么看 - 什么可能导致这个错误?