我试图按照下面的教程,但我遇到了一个问题“Docker compose up”。我不知道为什么我会收到“属性错误:'cached_property'对象没有属性'lock'“有人能指引我到这里吗?我一直在搜索互联网,但到目前为止,我发现没有什么能真正为我提供方向。
:https://www.youtube.com/watch?v=2j3em0QQaMghttps://github.com/PrettyPrinted/youtube_video_code/tree/master/2023/01/27/An%20Example%20of%20Celery%20in%20a%20Flask%20App%20With%20Multiple%20Files
Web 1代码1:Traceback(最后一次调用):
File "/usr/local/bin/flask", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.12/site-packages/flask/cli.py", line 1064, in main
cli.main()
File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/flask/cli.py", line 912, in run_command
raise e from None
File "/usr/local/lib/python3.12/site-packages/flask/cli.py", line 898, in run_command
app = info.load_app()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/flask/cli.py", line 309, in load_app
app = locate_app(import_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/flask/cli.py", line 219, in locate_app
__import__(module_name)
File "/app/run.py", line 3, in <module>
app, celery = create_app()
^^^^^^^^^^^^
File "/app/project/__init__.py", line 16, in create_app
celery = make_celery(app)
^^^^^^^^^^^^^^^^
File "/app/project/utils.py", line 12, in make_celery
celery.Task = ContextTask
^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/kombu/utils/objects.py", line 37, in __set__
with self.lock:
^^^^^^^^^
属性错误:“cached_property”对象没有属性“lock”
密码2:用法:celery [OPTIONS] COMMAND [ARGS].试试“celery --help”寻求帮助。
错误:“-A”/“--app”的值无效:无法加载celery应用程序。“cached_property”对象没有属性“lock”,退出代码为2
我已经搜索了Stackoverflow和其他帮助网站,但我找到的任何答案似乎都不足以让我深入了解解决方案。
2条答案
按热度按时间sg24os4d1#
这是python 3.12上的已知问题,请参阅:https://github.com/celery/kombu/issues/1804
yiytaume2#
我在使用python 3.12时遇到了同样的问题,我把python版本改为3.11,问题解决了。