pcktm/agh-vpr

AttributeError: module 'jwt' has no attribute 'encode'

Closed this issue · 4 comments

pcktm commented
INFO:     10.242.26.157:44378 - "POST /user/register HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/pcktm/.local/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/home/pcktm/.local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 92, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 147, in simple_response
    await self.app(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/home/pcktm/.local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/home/pcktm/.local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/home/pcktm/.local/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/home/pcktm/.local/lib/python3.10/site-packages/fastapi/routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "/home/pcktm/.local/lib/python3.10/site-packages/fastapi/routing.py", line 161, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/pcktm/Documents/studia/bielecki/api/./routers/users.py", line 22, in create_user
    return await crud.create_token(user)
  File "/home/pcktm/Documents/studia/bielecki/api/./crud.py", line 56, in create_token
    token = jwt.encode(user_obj.dict(), JWT_SECRET)
AttributeError: module 'jwt' has no attribute 'encode'

image
Czy robię coś źle? Krzyczy na mnie....

Kurczę nie wiem czemu tak masz, dałam teraz te same dane co Ty i przeszło
Untitled

może spróbuj ewentualnie jeszcze raz sb requirements.txt zainstalować, bo mam tez ten projekt drugi raz u siebie zrobiony i tam sb venv robiłam tym co napisałam w readme i tam rejestracja tez działa

pcktm commented

Och super, dzięki to działa. Pojebany ten python jest ze dwie rozne libki sie importuja pod tą samą nazwą xdd