getting ImportError: cannot import name 'escape' from 'jinja2' with python3 src/server.py
zinyosrim opened this issue · 2 comments
zinyosrim commented
Traceback (most recent call last):
File "/Users/deniz/Dev/shopify-flask-example/src/server.py", line 6, in <module>
from flask import Flask, redirect, request, render_template
File "/Users/deniz/Dev/shopify-flask-example/.venv/lib/python3.9/site-packages/flask/__init__.py", line 14, in <module>
from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/Users/deniz/Dev/shopify-flask-example/.venv/lib/python3.9/site-packages/jinja2/__init__.py)
Can be quick fixed with:
pip uninstall flask
pip install flask
Solution:
Remove Flask version dependency in requirements.txt or use 2.3.2
garettB commented
Thanks for the post and solution. I do need to update the sample in a few areas, notably upgrading flask to v2.
If updating the version works as-is for you and you are able to submit a PR I would greatly appreciate it! I'm hoping to have some time to update the sample this summer.