Django managment command executed by cron cause an error -


i have following 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 

so, in log file see following error:

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] price %s , qty %s' % (product_title, product_price, product_qty) unicodeencodeerror: 'ascii' codec can't encode characters in position 34-35: ordinal not in range(128) 

but when try manually run thic command - it's ok. think - may cause error?

the problem locale cron not set properly.

in /etc/environment set

lang=en_us.utf-8 

this link useful: locale setting cron job

and question also: python3: unicodeencodeerror when run crontab


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -