Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Flask import Error of module that isn´t being imported

I have a flask app running in Google App Engine. Yesterday, I deployed a new version of my app where I only change the HTML style. It deployed as it was supposed to. Today, I realized that I didn't change the title for each corresponding HTML page, so I only changed the title tag in each HTML page. I deployed the app again and now I'm getting this strange error of an Import Error for a module that I have never even used. How can I fix this?

The error:

ImportError: cannot import name 'json' from 'itsdangerous' (/layers/google.python.pip/pip/lib/python3.7/site-packages/itsdangerous/__init__.py)

EDIT FEB 24, 2022:

enter image description here

as you can see, the original folder to python3.7 has been replaced with python3.9

Is this normal in GAE?

like image 685
santiagoorpi Avatar asked May 16 '26 09:05

santiagoorpi


1 Answers

This issue on Flask's GitHub is related.

Either update to Flask>2, or if that's not possible pin ItsDangerous<2 and MarkupSafe<2.

To pin to lower versions in a requirements.txt file:

flask==1.1.4
itsdangerous==1.1.0
markupsafe==1.1.1
like image 114
John McCabe Avatar answered May 18 '26 22:05

John McCabe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!