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?
3
Answers
In the latest version of itsdangerous, TimedJSONWebSignatureSerializer is no longer available. Try this instead. It worked for me.
from itsdangerous import URLSafeTimedSerializer as Serializer
Itsdangerous is a very common and popular package used for serialization in other packages and apps.
To fix this:
pip install flask –upgrade
pip install itsdangerous==2.0.1
pip install email_validator
I hope this fixes the issue for you. Happy Coding
First make sure to re-install and update itsdangerous.
pip install -U itsdangerous
Then what you want to do is
This works well.