0
我想運行例如,從官方教程代碼(tasks.py):芹菜拋出的UnicodeDecodeError時嘗試啓動
from celery import Celery
app = Celery('tasks', broker='amqp://[email protected]//')
@app.task
def add(x, y): return x + y
我用命令「芹菜-A任務工人--loglevel =信息」,如圖教程。 但是,當我執行這個命令python拋出的UnicodeDecodeError:
C:\kaznmu\virtualenvs\example\Scripts>celery -A tasks worker --loglevel=info
Traceback (most recent call last):
File "C:\kaznmu\virtualenvs\example\Scripts\celery-script.py", line 9, in <mod
ule>
load_entry_point('celery==3.1.8', 'console_scripts', 'celery')()
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\__main__.py", lin
e 30, in main
main()
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\celery.py", l
ine 80, in main
cmd.execute_from_commandline(argv)
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\celery.py", l
ine 746, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\base.py", lin
e 308, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\celery.py", l
ine 738, in handle_argv
return self.execute(command, argv)
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\celery.py", l
ine 692, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\worker.py", l
ine 175, in run_from_argv
return self(*args, **options)
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\base.py", lin
e 271, in __call__
ret = self.run(*args, **kwargs)
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\worker.py", l
ine 195, in run
hostname = self.simple_format(default_nodename(hostname))
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\base.py", lin
e 569, in simple_format
return self._simple_format(s, socket.gethostname(), **extra)
File "C:\kaznmu\virtualenvs\example\lib\site-packages\celery\bin\base.py", lin
e 574, in _simple_format
name, _, domain = host.partition('.')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcf in position 5: ordinal
not in range(128)
- 我試着重新安裝所有的Python庫,並使用不同的版本,但是這並沒有幫助。我如何運行芹菜?
- 我使用的Windows7和Python2.7
- 官方教程這裏http://docs.celeryproject.org/en/master/getting-started/first-steps-with-celery.html#first-steps