完整报错:
Exception in callback <Task pending name='Task-1' coro=<Server.serve() running at C:\customData\ouRunTe\epowerdoc.venv\lib\site-packages\uvicorn\server.py:71> cb=[_run_until_complete_cb() at C:\Users\12433\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py:184]>() handle: <Handle <Task pending name='Task-1' coro=<Server.serve() running at C:\customData\ouRunTe\epowerdoc.venv\lib\site-packages\uvicorn\server.py:71> cb=[_run_until_complete_cb() at C:\Users\12433\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py:184]>()> Traceback (most recent call last): File "C:\Users\12433\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) TypeError: 'Task' object is not callable
背景:
PyCharm2024.1.4环境下,运行fastapi项目无报错,但是在debug运行就出现了异常。
解决:
Help->Find Action->搜Registry->取消勾选python.debug.asyncio.repl