await asyncio.sleep 中的类型错误('dict' 对象不可调用)
TypeError in await asyncio.sleep ('dict' object is not callable)
我最近开始使用 python 并在我的 aiohttp
服务器上收到以下错误日志:
ERROR:app.handlers.socket_handler:'dict' object is not callable
Traceback (most recent call last):
File "[...]/app/handlers/socket_handler.py", line 47, in try_coroutine
await coroutine
File "[...]/app/handlers/socket_handler.py", line 65, in do_stuff
async for data in stuff_repo.observe_stuff(search=param_search):
File "[...]/app/repositories/stuff_repository.py", line 74, in observe_stuff
await asyncio.sleep(sleep_for)
TypeError: 'dict' object is not callable
这对我来说没有任何意义,因为 dict
对象和 callable
都没有参与 asyncio.sleep
调用,而 sleep_for
是一个值为 30 的 int, 在任何时候都没有被修改,只读:
代码可能有什么问题?
这是一个 PyCharm 错误,因为它仅在已调试时添加断点时才会导致。
修复:
添加环境变量PYDEVD_USE_FRAME_EVAL=NO
来源:
我最近开始使用 python 并在我的 aiohttp
服务器上收到以下错误日志:
ERROR:app.handlers.socket_handler:'dict' object is not callable
Traceback (most recent call last):
File "[...]/app/handlers/socket_handler.py", line 47, in try_coroutine
await coroutine
File "[...]/app/handlers/socket_handler.py", line 65, in do_stuff
async for data in stuff_repo.observe_stuff(search=param_search):
File "[...]/app/repositories/stuff_repository.py", line 74, in observe_stuff
await asyncio.sleep(sleep_for)
TypeError: 'dict' object is not callable
这对我来说没有任何意义,因为 dict
对象和 callable
都没有参与 asyncio.sleep
调用,而 sleep_for
是一个值为 30 的 int, 在任何时候都没有被修改,只读:
代码可能有什么问题?
这是一个 PyCharm 错误,因为它仅在已调试时添加断点时才会导致。
修复:
添加环境变量PYDEVD_USE_FRAME_EVAL=NO
来源: