python-demoapp icon indicating copy to clipboard operation
python-demoapp copied to clipboard

ImportError: cannot import name 'escape' from 'jinja2'

Open bizimunda opened this issue 3 years ago • 5 comments

I am getting this error message

Traceback (most recent call last): File "/Users/hamid/GitLab/Gitlab_Techworld_nina/python-demoapp/src/run.py", line 2, in from app import create_app File "/Users/hamid/GitLab/Gitlab_Techworld_nina/python-demoapp/src/app/init.py", line 1, in from flask import Flask File "/Users/hamid/GitLab/Gitlab_Techworld_nina/python-demoapp/src/.venv/lib/python3.9/site-packages/flask/init.py", line 14, in from jinja2 import escape ImportError: cannot import name 'escape' from 'jinja2' (/Users/hamid/GitLab/Gitlab_Techworld_nina/python-demoapp/src/.venv/lib/python3.9/site-packages/jinja2/init.py) make: *** [run] Error 1

and this is what I have in my requirement file

Flask==2.1.0 py-cpuinfo==7.0.0 psutil==5.8.0 gunicorn==20.1.0 black==20.8b1 flake8==3.9.0 pytest==7.1.2

bizimunda avatar Nov 02 '22 14:11 bizimunda

@benc-uk do you have solution for that ? Would be highly appreciated !

3ika3ika avatar Jan 20 '23 23:01 3ika3ika

Hi, This repo and app is really something I'm no longer supporting or using in anyway Sorry

benc-uk avatar Jan 22 '23 09:01 benc-uk

my solution from stackoverflow:

requirements.txt

Flask==2.1.0
py-cpuinfo==7.0.0
psutil==5.8.0
gunicorn==20.1.0
black==20.8b1
flake8==3.9.0
pytest==6.2.5

Sources:

  1. https://stackoverflow.com/a/71735103/3388671
  2. https://stackoverflow.com/a/69569206/3388671

leonidkiritschenko avatar Feb 03 '23 10:02 leonidkiritschenko

The solution from leonidkirischenko works well!

main-voice avatar Apr 07 '23 02:04 main-voice

Yeah, change the requirement.txt to Flask>=2.2.2 py-cpuinfo==7.0.0 psutil==5.8.0 gunicorn==20.1.0 black==20.8b1 flake8==3.9.0 pytest==6.2.2 fix the issue

Dustin-Wang avatar Aug 04 '23 05:08 Dustin-Wang