Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Exception in ASGI application for webapps -> fastapi -> uvicorn #9

Open
jiapei100 opened this issue Feb 21, 2022 · 1 comment

Comments

@jiapei100
Copy link

fastapi git:(master) ✗ uvicorn app:app --reload
INFO:     Will watch for changes in these directories: ['~/....../python-fun/webapps/fastapi']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [2387967] using watchgod
INFO:     Started server process [2387969]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     127.0.0.1:58440 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "~/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "~/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/fastapi/applications.py", line 259, in __call__
    await super().__call__(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/applications.py", line 119, in __call__
    await self.middleware_stack(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 87, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 76, in __call__
    await self.app(scope, receive, sender)
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 659, in __call__
    await route.handle(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "~/.local/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
    solved_result = await solve_dependencies(
  File "~/.local/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 465, in solve_dependencies
    response = response or Response(
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 50, in __init__
    self.init_headers(headers)
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 77, in init_headers
    and not (self.status_code < 200 or self.status_code in (204, 304))
TypeError: '<' not supported between instances of 'NoneType' and 'int'
INFO:     127.0.0.1:58442 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:58444 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "~/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "~/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/fastapi/applications.py", line 259, in __call__
    await super().__call__(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/applications.py", line 119, in __call__
    await self.middleware_stack(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 87, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 76, in __call__
    await self.app(scope, receive, sender)
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 659, in __call__
    await route.handle(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "~/.local/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
    solved_result = await solve_dependencies(
  File "~/.local/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 465, in solve_dependencies
    response = response or Response(
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 50, in __init__
    self.init_headers(headers)
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 77, in init_headers
    and not (self.status_code < 200 or self.status_code in (204, 304))
TypeError: '<' not supported between instances of 'NoneType' and 'int'
^CINFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [2387969]
INFO:     Stopping reloader process [2387967]
@stonebig
Copy link
Contributor

stonebig commented May 1, 2022

so for me it works, even on pypy3.8-v7.3.9-win64, when I do this :

pip install fastapi "uvicorn[standard]" python-multipart sqlalchemy jinja2

python -m webbrowser -t "http://127.0.0.1:8000/"
python -m webbrowser -t "http://127.0.0.1:8000/docs"

uvicorn app:app --reload

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants