garettB / shopify-flask-example

A simple Shopify app created using Flask and Python
Other
229 stars 66 forks source link

getting ImportError: cannot import name 'escape' from 'jinja2' with python3 src/server.py #23

Open zinyosrim opened 1 year ago

zinyosrim commented 1 year ago
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 1 year ago

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.

zinyosrim commented 1 year ago

You're welcome. The issue is documented here