celery worker启动报错:AttributeError: 'str' object has no attribute 'items'

celery worker启动报错:AttributeError: 'str' object has no attribute 'items'

Dawn
2020-11-19 / 0 评论 / 378 阅读 / 正在检测是否收录...

1.错误演示

[2020-11-18 11:11:41,548: ERROR/MainProcess] Unrecoverable error: AttributeError("'str' object has no attribute 'items'",)
Traceback (most recent call last):
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\worker\__init__.py", line 206, in start
    self.blueprint.start(self)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\bootsteps.py", line 123, in start
    step.start(parent)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\bootsteps.py", line 374, in start
    return self.obj.start()
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\worker\consumer.py", line 280, in start
    blueprint.start(self)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\bootsteps.py", line 123, in start
    step.start(parent)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\worker\consumer.py", line 884, in start
    c.loop(*c.loop_args())
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\celery\worker\loops.py", line 103, in synloop
    connection.drain_events(timeout=2.0)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\kombu\connection.py", line 288, in drain_events
    return self.transport.drain_events(self.connection, **kwargs)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\kombu\transport\virtual\__init__.py", line 847, in drain_events
    self._callbacks[queue](message)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\kombu\transport\virtual\__init__.py", line 534, in _callback
    self.qos.append(message, message.delivery_tag)
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\kombu\transport\redis.py", line 146, in append
    pipe.zadd(self.unacked_index_key, delivery_tag, time()) \
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\redis\client.py", line 2685, in zadd
    for pair in iteritems(mapping):
  File "E:\PyCharm_code\Venv\djtest1\lib\site-packages\redis\_compat.py", line 159, in iteritems
    return iter(x.items())
AttributeError: 'str' object has no attribute 'items'

2.解决办法

报错的原因在于redis版本过高,对redis降级就可以了

  • 卸载redis
pip uninstall redis
  • 重新安装redis
pip install redis==2.10.6
0

评论 (0)

取消