Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'escape' from 'jinja2' after upgrading to 3.1.0 #1633

Closed
akshjain83 opened this issue Mar 24, 2022 · 2 comments

Comments

@akshjain83
Copy link

akshjain83 commented Mar 24, 2022

Describe how to replicate the bug.

The import works with 3.0.3

(env) cl-akshayjain:tests ajain$ pip freeze | grep Jinja2
Jinja2==3.0.3
(env) cl-akshayjain:tests ajain$ python
Python 3.7.4 (default, Sep  7 2019, 18:27:02) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from jinja2 import escape
>>> exit()

The import fails with 3.1.0 (published today)

(env) cl-akshayjain:tests ajain$ pip install -U jinja2
Collecting jinja2
  Downloading Jinja2-3.1.0-py3-none-any.whl (132 kB)
     |████████████████████████████████| 132 kB 1.4 MB/s 
Installing collected packages: jinja2
  Attempting uninstall: jinja2
    Found existing installation: Jinja2 3.0.3
    Uninstalling Jinja2-3.0.3:
      Successfully uninstalled Jinja2-3.0.3
Successfully installed jinja2-3.1.0
(env) cl-akshayjain:tests ajain$ python
Python 3.7.4 (default, Sep  7 2019, 18:27:02) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from jinja2 import escape
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'escape' from 'jinja2' (env/lib/python3.7/site-packages/jinja2/__init__.py)

Expected Behavior:
ImportError is fixed. Please let me know if the change was intended in the latest version and this indeed is expected behavior. Thanks.

Environment:

  • Python version: 3.7.4
  • Jinja version: 3.1.0
@davidism
Copy link
Member

Duplicate of #1626

@VictorDavis
Copy link

Thanks, @akshjain83, freezing jinja2==3.0.3 worked for me!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants