Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x044845D0>

本文解决了在使用PyCharm运行Django项目时遇到的ImportError问题,详细记录了从定位问题到卸载旧版Django并安装指定版本的全过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我的环境:
操作系统:windows10
pycharm:pycharm-professional-2017.2.3
python:python3.6.2
django:1.11

一个小菜鸟的第一篇技术类博客,先从我今天解决的一个pycharm的报错开始吧~
完整报错展示:

"D:\web\pycharmPro\PyCharm 2017.2.3\bin\runnerw.exe" D:\web\python\python.exe D:/pycharm/myProject/manage.py runserver 127.0.0.1:8000
Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x044845D0>
Traceback (most recent call last):
  File "D:\web\python\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "D:\web\python\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "D:\web\python\lib\site-packages\django\core\management\base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "D:\web\python\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "D:\web\python\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "D:\web\python\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "D:\web\python\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
    return check_method()
  File "D:\web\python\lib\site-packages\django\urls\resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "D:\web\python\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\web\python\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\web\python\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\web\python\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "D:\web\python\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "D:\pycharm\myProject\myProject\urls.py", line 17, in <module>
    from django.urls import path
ImportError: cannot import name 'path'

这个报错我在网上找了半天,都没找到一个满意的解决方法,然后我就在想是不是django的版本不对(我之前下载的django2.0),于是我就重新下载了一个django1.11版本

于是,问题就来了:
怎样卸载以前装的django2.0呢?

我又在网上看了一圈儿,有解决方,那些解决方法里又有写什么要看当时怎么安装,是通过“pip install django == x.xx(版本号)”安装还是用什么egg啥的
反正我也不记得了

按照大神的方法我也没有找到要找的文件夹(site-packages),于是我就用了最简单粗暴的方法:windows文件管理器的搜索功能:
这里写图片描述

然后删除所有django的文件夹就好了(好像就只有一个),对,文件夹就好

然后就可以用pip命令来安装django1.11啦~

pip install django1.11

安装完成后就可以新建项目啦,反正新我建项目之后就没有出现这个报错了~~~
(要记得新建项目哈,我刚开始没有新建项目,依然出现那个报错,大概是那个原项目里还是用的django2.0吧,不是很懂~)

处女座,虽然做了两年网络工程的学生了,但依然和小白没啥区别·····
所以只能解决这些小白问题了~~
2018年计划每周更新一篇博客
嘿嘿嘿嘿
加油啦~~

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "D:\application\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) │ │ └ 724 │ └ 3 └ <function _main at 0x0000028CCCDAA830> File "D:\application\Python310\lib\multiprocessing\spawn.py", line 129, in _main return self._bootstrap(parent_sentinel) │ │ └ 724 │ └ <function BaseProcess._bootstrap at 0x0000028CCCCD1B40> └ <SpawnProcess name='SpawnProcess-1' parent=16008 started> File "D:\application\Python310\lib\multiprocessing\process.py", line 315, in _bootstrap self.run() │ └ <function BaseProcess.run at 0x0000028CCCCD11B0> └ <SpawnProcess name='SpawnProcess-1' parent=16008 started> File "D:\application\Python310\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) │ │ │ │ │ └ {'config': <uvicorn.config.Config object at 0x0000028CCCD9F3A0>, 'target': <bound method Server.run of <uvicorn.server.Server... │ │ │ │ └ <SpawnProcess name='SpawnProcess-1' parent=16008 started> │ │ │ └ () │ │ └ <SpawnProcess name='SpawnProcess-1' parent=16008 started> │ └ <function subprocess_started at 0x0000028CCD9AED40> └ <SpawnProcess name='SpawnProcess-1' parent=16008 started> File "D:\pyVenv\mypyenv310\lib\site-packages\uvicorn\_subprocess.py", line 80, in subprocess_started target(sockets=sockets) │ └ [<socket.socket fd=836, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 9999)>] └ <bound method Server.run of <uvicorn.server.Server object at 0x0000028CCCD9F4C0>> File "D:\pyVenv\mypyenv310\lib\site-packages\uvicorn\server.py", line 66, in run return asyncio.run(self.serve(sockets=sockets)) │ │ │ │ └ [<socket.socket fd=836, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 9999)>] │ │ │ └ <function Server.serve at 0x0000028CCD997640> │ │ └ <uvicorn.server.Server object at 0x0000028CCCD9F4C0> │ └ <function run at 0x0000028CCCDBD1B0> └ <module 'asyncio' from 'D:\\application\\Python310\\lib\\asyncio\\__init__.py'> File "D:\application\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) │ │ └ <coroutine object Server.serve at 0x0000028CCD98EA40> │ └ <function BaseEventLoop.run_until_complete at 0x0000028CCD1FA710> └ <_WindowsSelectorEventLoop running=True closed=False debug=False> File "D:\application\Python310\lib\asyncio\base_events.py", line 628, in run_until_complete self.run_forever() │ └ <function BaseEventLoop.run_forever at 0x0000028CCD1FA680> └ <_WindowsSelectorEventLoop running=True closed=False debug=False> File "D:\application\Python310\lib\asyncio\base_events.py", line 595, in run_forever self._run_once() │ └ <function BaseEventLoop._run_once at 0x0000028CCD1FC1F0> └ <_WindowsSelectorEventLoop running=True closed=False debug=False> File "D:\application\Python310\lib\asyncio\base_events.py", line 1881, in _run_once handle._run() │ └ <function Handle._run at 0x0000028CCD13FAC0> └ <Handle Task.task_wakeup(<Future cancelled>)> File "D:\application\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) │ │ │ │ │ └ <member '_args' of 'Handle' objects> │ │ │ │ └ <Handle Task.task_wakeup(<Future cancelled>)> │ │ │ └ <member '_callback' of 'Handle' objects> │ │ └ <Handle Task.task_wakeup(<Future cancelled>)> │ └ <member '_context' of 'Handle' objects> └ <Handle Task.task_wakeup(<Future cancelled>)> > File "D:\pyVenv\mypyenv310\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi result = await app( # type: ignore[func-returns-value] └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x0000028CCD9B63B0> File "D:\pyVenv\mypyenv310\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__ return await self.app(scope, receive, send) │ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57FE80>> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <fastapi.applications.FastAPI object at 0x0000028CEAF5EC20> └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x0000028CCD9B63B0> File "D:\pyVenv\mypyenv310\lib\site-packages\fastapi\applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57FE80>> │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\applications.py", line 113, in __call__ await self.middleware_stack(scope, receive, send) │ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57FE80>> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x0000028CEB1C6C20> └ <fastapi.applications.FastAPI object at 0x0000028CEAF5EC20> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\errors.py", line 187, in __call__ raise exc File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\errors.py", line 165, in __call__ await self.app(scope, receive, _send) │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x0000028CEB5DDA20> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <starlette.middleware.cors.CORSMiddleware object at 0x0000028CEB1C6BF0> └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x0000028CEB1C6C20> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\cors.py", line 93, in __call__ await self.simple_response(scope, receive, send, request_headers=headers) │ │ │ │ │ └ Headers({'host': '127.0.0.1:9999', 'connection': 'keep-alive', 'content-length': '87', 'sec-ch-ua-platform': '"Windows"', 'us... │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x0000028CEB5DDA20> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <function CORSMiddleware.simple_response at 0x0000028CEAF6B640> └ <starlette.middleware.cors.CORSMiddleware object at 0x0000028CEB1C6BF0> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\cors.py", line 144, in simple_response await self.app(scope, receive, send) │ │ │ │ └ functools.partial(<bound method CORSMiddleware.send of <starlette.middleware.cors.CORSMiddleware object at 0x0000028CEB1C6BF0... │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <app.core.middlewares.BackGroundTaskMiddleware object at 0x0000028CEB1C6B90> └ <starlette.middleware.cors.CORSMiddleware object at 0x0000028CEB1C6BF0> File "E:\Code\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 28, in __call__ await self.handle_http(scope, receive, send) │ │ │ │ └ functools.partial(<bound method CORSMiddleware.send of <starlette.middleware.cors.CORSMiddleware object at 0x0000028CEB1C6BF0... │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <function SimpleBaseMiddleware.handle_http at 0x0000028CEAF8C3A0> └ <app.core.middlewares.BackGroundTaskMiddleware object at 0x0000028CEB1C6B90> File "E:\Code\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 38, in handle_http await response(scope, receive, send_wrapper) │ │ │ └ <function SimpleBaseMiddleware.handle_http.<locals>.send_wrapper at 0x0000028CEBEA6050> │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x0000028CEB57F... │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... └ <app.core.middlewares.APILoggerMiddleware object at 0x0000028CEB1C6B30> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\base.py", line 185, in __call__ with collapse_excgroups(): └ <function collapse_excgroups at 0x0000028CCFAD4CA0> File "D:\application\Python310\lib\contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) │ │ │ │ │ └ <traceback object at 0x0000028CEB417D40> │ │ │ │ └ ExceptionGroup('unhandled errors in a TaskGroup', [AttributeError("'NoneType' object has no attribute 'get'")]) │ │ │ └ <class 'exceptiongroup.ExceptionGroup'> │ │ └ <method 'throw' of 'generator' objects> │ └ <generator object collapse_excgroups at 0x0000028CEBF19FC0> └ <contextlib._GeneratorContextManager object at 0x0000028CEB57E9B0> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_utils.py", line 82, in collapse_excgroups raise exc File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\base.py", line 188, in __call__ await response(scope, wrapped_receive, send) │ │ │ └ <function SimpleBaseMiddleware.handle_http.<locals>.send_wrapper at 0x0000028CEBEA6050> │ │ └ <bound method _CachedRequest.wrapped_receive of <starlette.middleware.base._CachedRequest object at 0x0000028CEB57DFC0>> │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... └ <starlette.middleware.base._StreamingResponse object at 0x0000028CEB586C80> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\base.py", line 222, in __call__ async for chunk in self.body_iterator: │ └ <async_generator object BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.body_stream at 0x0000028CEB5D9140> └ <starlette.middleware.base._StreamingResponse object at 0x0000028CEB586C80> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\base.py", line 179, in body_stream raise app_exc └ AttributeError("'NoneType' object has no attribute 'get'") File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\base.py", line 149, in coro await self.app(scope, receive_or_disconnect, send_no_error) │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x0000028CEBF10310> │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <app.core.middlewares.APILoggerAddResponseMiddleware object at 0x0000028CEB1C6A70> └ <app.core.middlewares.APILoggerMiddleware object at 0x0000028CEB1C6B30> File "E:\Code\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 28, in __call__ await self.handle_http(scope, receive, send) │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x0000028CEBF10310> │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <function SimpleBaseMiddleware.handle_http at 0x0000028CEAF8C3A0> └ <app.core.middlewares.APILoggerAddResponseMiddleware object at 0x0000028CEB1C6A70> File "E:\Code\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 38, in handle_http await response(scope, receive, send_wrapper) │ │ │ └ <function SimpleBaseMiddleware.handle_http.<locals>.send_wrapper at 0x0000028CEBF10A60> │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x0000028CEB1C6A40> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) │ │ │ │ │ │ └ <function SimpleBaseMiddleware.handle_http.<locals>.send_wrapper at 0x0000028CEBF10A60> │ │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ │ │ └ <starlette.requests.Request object at 0x0000028CEB585060> │ │ └ <fastapi.routing.APIRouter object at 0x0000028CEAF5E500> │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x0000028CEB1C6A40> └ <function wrap_app_handling_exceptions at 0x0000028CCFA97640> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app raise exc File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10790> │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... └ <fastapi.routing.APIRouter object at 0x0000028CEAF5E500> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\routing.py", line 715, in __call__ await self.middleware_stack(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10790> │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x0000028CEAF5E500>> └ <fastapi.routing.APIRouter object at 0x0000028CEAF5E500> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10790> │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <function Route.handle at 0x0000028CCFA40D30> └ APIRoute(path='/api/v1/zentao/dept/all', name='_', methods=['POST']) File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\routing.py", line 288, in handle await self.app(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10790> │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ └ <function request_response.<locals>.app at 0x0000028CEB11A680> └ APIRoute(path='/api/v1/zentao/dept/all', name='_', methods=['POST']) File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\routing.py", line 76, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) │ │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10790> │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... │ │ └ <starlette.requests.Request object at 0x0000028CEB585A80> │ └ <function request_response.<locals>.app.<locals>.app at 0x0000028CEBF10B80> └ <function wrap_app_handling_exceptions at 0x0000028CCFA97640> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app raise exc File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10C10> │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... └ <function request_response.<locals>.app.<locals>.app at 0x0000028CEBF10B80> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\routing.py", line 74, in app await response(scope, receive, send) │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10C10> │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x0000028CEBEA5F30> │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... └ <starlette.responses.JSONResponse object at 0x0000028CEB584850> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\responses.py", line 155, in __call__ await send({"type": prefix + "http.response.body", "body": self.body}) │ │ │ └ b'null' │ │ └ <starlette.responses.JSONResponse object at 0x0000028CEB584850> │ └ '' └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10C10> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_exception_handler.py", line 39, in sender await send(message) │ └ {'type': 'http.response.body', 'body': b'null'} └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000028CEBF10790> File "D:\pyVenv\mypyenv310\lib\site-packages\starlette\_exception_handler.py", line 39, in sender await send(message) │ └ {'type': 'http.response.body', 'body': b'null'} └ <function SimpleBaseMiddleware.handle_http.<locals>.send_wrapper at 0x0000028CEBF10A60> File "E:\Code\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 35, in send_wrapper await self.after_request(request, _response) │ │ │ └ {'type': 'http.response.body', 'body': b'null'} │ │ └ <starlette.requests.Request object at 0x0000028CEB584040> │ └ <function APILoggerAddResponseMiddleware.after_request at 0x0000028CEAF8C700> └ <app.core.middlewares.APILoggerAddResponseMiddleware object at 0x0000028CEB1C6A70> File "E:\Code\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 120, in after_request api_log_obj.response_code = resp.get("code", "-1") │ │ └ None │ └ None └ <APILog: 11321> AttributeError: 'NoneType' object has no attribute 'get'
07-23
2025-08-04 10:28:21.088 | ERROR | uvicorn.protocols.http.h11_impl:run_asgi:434 - Exception in ASGI application + Exception Group Traceback (most recent call last): | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\_utils.py", line 76, in collapse_excgroups | yield | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\base.py", line 186, in __call__ | async with anyio.create_task_group() as task_group: | │ │ └ <anyio._backends._asyncio.TaskGroup object at 0x000001A381063730> | │ └ <function create_task_group at 0x000001A3F0A1C790> | └ <module 'anyio' from 'D:\\dev\\EquipmentRegistryDataPlatform\\venv\\lib\\site-packages\\anyio\\__init__.py'> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 815, in __aexit__ | raise BaseExceptionGroup( | └ <class 'exceptiongroup.BaseExceptionGroup'> | | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 429, in run_asgi | result = await app( # type: ignore[func-returns-value] | └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x000001A3EF059690> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__ | return await self.app(scope, receive, send) | │ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062890>> | │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | │ └ <fastapi.applications.FastAPI object at 0x000001A3FF747340> | └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x000001A3EF059690> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\fastapi\applications.py", line 1054, in __call__ | await super().__call__(scope, receive, send) | │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062890>> | │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\applications.py", line 113, in __call__ | await self.middleware_stack(scope, receive, send) | │ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062890>> | │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | │ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x000001A3FFC93670> | └ <fastapi.applications.FastAPI object at 0x000001A3FF747340> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\errors.py", line 187, in __call__ | raise exc | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\errors.py", line 165, in __call__ | await self.app(scope, receive, _send) | │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x000001A3F136C940> | │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | │ └ <starlette.middleware.cors.CORSMiddleware object at 0x000001A3FFC93760> | └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x000001A3FFC93670> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\cors.py", line 93, in __call__ | await self.simple_response(scope, receive, send, request_headers=headers) | │ │ │ │ │ └ Headers({'host': '127.0.0.1:9999', 'connection': 'keep-alive', 'content-length': '34', 'pragma': 'no-cache', 'cache-control':... | │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x000001A3F136C940> | │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | │ └ <function CORSMiddleware.simple_response at 0x000001A3FF87D1B0> | └ <starlette.middleware.cors.CORSMiddleware object at 0x000001A3FFC93760> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\cors.py", line 144, in simple_response | await self.app(scope, receive, send) | │ │ │ │ └ functools.partial(<bound method CORSMiddleware.send of <starlette.middleware.cors.CORSMiddleware object at 0x000001A3FFC93760... | │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | │ └ <app.core.middlewares.BackGroundTaskMiddleware object at 0x000001A3FFC936D0> | └ <starlette.middleware.cors.CORSMiddleware object at 0x000001A3FFC93760> | | File "D:\dev\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 28, in __call__ | await self.handle_http(scope, receive, send) | │ │ │ │ └ functools.partial(<bound method CORSMiddleware.send of <starlette.middleware.cors.CORSMiddleware object at 0x000001A3FFC93760... | │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | │ └ <function SimpleBaseMiddleware.handle_http at 0x000001A3FF87DEA0> | └ <app.core.middlewares.BackGroundTaskMiddleware object at 0x000001A3FFC936D0> | | File "D:\dev\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 38, in handle_http | await response(scope, receive, send_wrapper) | │ │ │ └ <function SimpleBaseMiddleware.handle_http.<locals>.send_wrapper at 0x000001A3F136C700> | │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x000001A381062... | │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 9999), 'cl... | └ <app.core.middlewares.APILoggerMiddleware object at 0x000001A3FFC93D90> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\base.py", line 185, in __call__ | with collapse_excgroups(): | └ <function collapse_excgroups at 0x000001A3F0C3C9D0> | | File "C:\Program Files\Python310\lib\contextlib.py", line 153, in __exit__ | self.gen.throw(typ, value, traceback) | │ │ │ │ │ └ <traceback object at 0x000001A3811BAB00> | │ │ │ │ └ ExceptionGroup('unhandled errors in a TaskGroup', [TypeError("'module' object is not callable")]) | │ │ │ └ <class 'exceptiongroup.ExceptionGroup'> | │ │ └ <method 'throw' of 'generator' objects> | │ └ <generator object collapse_excgroups at 0x000001A3810ED620> | └ <contextlib._GeneratorContextManager object at 0x000001A381063CD0> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\_utils.py", line 82, in collapse_excgroups | raise exc | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\base.py", line 187, in __call__ | response = await self.dispatch_func(request, call_next) | │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x000001A3F136C820> | │ │ └ <starlette.middleware.base._CachedRequest object at 0x000001A381063F40> | │ └ <bound method APILoggerMiddleware.dispatch of <app.core.middlewares.APILoggerMiddleware object at 0x000001A3FFC93D90>> | └ <app.core.middlewares.APILoggerMiddleware object at 0x000001A3FFC93D90> | | File "D:\dev\EquipmentRegistryDataPlatform\app\core\middlewares.py", line 103, in dispatch | response = await call_next(request) | │ └ <starlette.middleware.base._CachedRequest object at 0x000001A381063F40> | └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x000001A3F136C820> | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\base.py", line 163, in call_next | raise app_exc | └ TypeError("'module' object is not callable") | | File "D:\dev\EquipmentRegistryDataPlatform\venv\lib\site-packages\starlette\middleware\base.py", line 149, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x000001A381249E10> | │ │ │
最新发布
08-05
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值