问答详情
源自:4-1 Django 中配置使用 Celery

python manage.py celery worker -l INFO必报这个错

环境:python3.6+django.2.0,是不是Django 版本太高了, 我看视频用的1.8


[2018-12-18 15:04:36,822: WARNING/MainProcess] /Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/billiard/__init__.py:321: RuntimeWarning: force_execv is not supported as the billiard C extension is not installed


  warnings.warn(RuntimeWarning(W_NO_EXECV))


[2018-12-18 15:04:37,099: INFO/MainProcess] Connected to redis://:**@127.0.0.1:6379/1


[2018-12-18 15:04:37,111: INFO/MainProcess] mingle: searching for neighbors


[2018-12-18 15:04:38,119: INFO/MainProcess] mingle: all alone


[2018-12-18 15:04:38,131: WARNING/MainProcess] /Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/djcelery/loaders.py:133: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!


  warn('Using settings.DEBUG leads to a memory leak, never '


[2018-12-18 15:04:38,131: WARNING/MainProcess] celery@TesterCCdeMacBook-Pro.local ready.


[2018-12-18 15:04:39,732: ERROR/MainProcess] Unrecoverable error: AttributeError("'str' object has no attribute 'items'",)


Traceback (most recent call last):


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/__init__.py", line 206, in start


    self.blueprint.start(self)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/bootsteps.py", line 123, in start


    step.start(parent)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/bootsteps.py", line 374, in start


    return self.obj.start()


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/consumer.py", line 280, in start


    blueprint.start(self)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/bootsteps.py", line 123, in start


    step.start(parent)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/consumer.py", line 884, in start


    c.loop(*c.loop_args())


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/loops.py", line 76, in asynloop


    next(loop)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/async/hub.py", line 340, in create_loop


    cb(*cbargs)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/transport/redis.py", line 1019, in on_readable


    self._callbacks[queue](message)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/transport/virtual/__init__.py", line 534, in _callback


    self.qos.append(message, message.delivery_tag)


  File "/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/transport/redis.py", line 146, in append


    pipe.zadd(self.unacked_index_key, delivery_tag, time()) \


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/redis/client.py", line 2263, in zadd


    for pair in iteritems(mapping):


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/redis/_compat.py", line 123, in iteritems


    return iter(x.items())


AttributeError: 'str' object has no attribute 'items'


提问者:网络侦探 2018-12-18 15:12

个回答

  • 慕尼黑2271025
    2019-04-25 23:36:03

    django 2.1.7 

    python 3.6.5

    redis 2.10.0


  • 慕尼黑2271025
    2019-04-25 23:35:13

    不行啊,还是报错


  • 慕侠1439365
    2019-01-07 11:18:22

    这是因为pip install redis 的版本过高

    使用2.10版本即 pip install redis==2.10即可