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' #1

Closed
skounis opened this issue Oct 6, 2022 · 1 comment · Fixed by #2
Closed

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

skounis opened this issue Oct 6, 2022 · 1 comment · Fixed by #2

Comments

@skounis
Copy link
Owner

skounis commented Oct 6, 2022

Describe the bug, issue or concern

make test gives

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

More detailed:

python -m pytest -vv --cov=app test_app.py
============================================================================================================ test session starts =============================================================================================================
platform linux -- Python 3.8.10, pytest-6.2.2, py-1.11.0, pluggy-0.13.1 -- /home/skounis/.kube-hello/bin/python
cachedir: .pytest_cache
rootdir: /home/skounis/python/cdf-kubernetes-hello-world-python-flask
plugins: cov-2.11.1
collected 0 items / 1 error                                                                                                                                                                                                                  

=================================================================================================================== ERRORS ===================================================================================================================
________________________________________________________________________________________________________ ERROR collecting test_app.py ________________________________________________________________________________________________________
ImportError while importing test module '/home/skounis/python/cdf-kubernetes-hello-world-python-flask/test_app.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../.kube-hello/lib/python3.8/site-packages/_pytest/python.py:578: in _importtestmodule
    mod = import_path(self.fspath, mode=importmode)
../../.kube-hello/lib/python3.8/site-packages/_pytest/pathlib.py:531: in import_path
    importlib.import_module(module_name)
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
../../.kube-hello/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
test_app.py:1: in <module>
    from app import change
app.py:1: in <module>
    from flask import Flask
../../.kube-hello/lib/python3.8/site-packages/flask/__init__.py:14: in <module>
    from jinja2 import escape
E   ImportError: cannot import name 'escape' from 'jinja2' (/home/skounis/.kube-hello/lib/python3.8/site-packages/jinja2/__init__.py)

---------- coverage: platform linux, python 3.8.10-final-0 -----------
Name     Stmts   Miss  Cover
----------------------------
app.py      29     28     3%
----------------------------
TOTAL       29     28     3%

========================================================================================================== short test summary info ===========================================================================================================
ERROR test_app.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================================== 1 error in 0.08s ==============================================================================================================
make: *** [Makefile:10: test] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant