芹菜工人没跑

时间:2014-03-08 04:32:21

标签: python celery

下面是我跑步时的追溯

celery -A tasks worker -l info

我无法弄清楚什么是错的。

Traceback (most recent call last):
  File "/usr/local/bin/celery", line 9, in <module>
    load_entry_point('celery==3.1.7', 'console_scripts', 'celery')()
  File "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 30, in main
    main()
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 80, in main
    cmd.execute_from_commandline(argv)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 723, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 301, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 431, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 451, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/utils.py", line 233, in find_app
    found = sym.celery
AttributeError: 'module' object has no attribute 'celery'

最令人沮丧的部分是它昨晚没有错误。

2 个答案:

答案 0 :(得分:0)

检查您的PYTHONPATH是否有旧的芹菜代码。

我在utils.py的同一行(与芹菜3.1.10)有完全相同的错误。

原因是我有一些旧目录包含来自早期版本Celery的实验,这些是通过PYTHONPATH获取的。我从PYTHONPATH中删除了旧目录,一切都开始工作了。

答案 1 :(得分:0)

假设这是您的文件树:

APP

- &GT; MyProject的

- - - - &GT; celery.py

- &GT; run_celery.py

run_celery.py包含此行:

celery -A tasks worker -l info

从celery.py文件以上的一个级别开始。

run_celery.py应与MyProject

处于同一级别