I'm running a flask app using itsdangerous python package in AWS EC2 instance.
Traceback (most recent call last):
File "run.py", line 4, in <module>
app = create_app()
File "/home/ubuntu/RHS_US/application/portal/__init__.py", line 29, in create_app
from portal.users.routes import users
File "/home/ubuntu/RHS_US/application/portal/users/routes.py", line 7, in <module>
from portal.models import User
File "/home/ubuntu/RHS_US/application/portal/models.py", line 7, in <module>
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
ImportError: cannot import name 'TimedJSONWebSignatureSerializer' from 'itsdangerous' (/home/ubuntu/.local/lib/python3.7/site-packages/itsdangerous/__init__.py)
Any resolution for this?
CodePudding user response:
In the latest version of itsdangerous, TimedJSONWebSignatureSerializer is no longer available. Try this instead. It worked for me. from itsdangerous import URLSafeTimedSerializer as Serializer
CodePudding user response:
Itsdangerous is a very common and popular package used for serialization in other packages and apps. To fix this:
- Upgrade your Flask to the newest version ---
pip install flask –upgrade
- Downgrade itsdangerous to version 2.0.1 ---
pip install itsdangerous==2.0.1
- After downgrading it, install email_validator again to make the issue fixed ---
pip install email_validator
I hope this fixes the issue for you. Happy Coding