or
ImportError: cannot import name 'escape' from 'jinja2'
There is no possibility to import name 'escape' from 'flask' (or jinja2).
Today the simplest way is to use
from markupsafe import escape
instead of from flask import escape
.
Jinja is a dependency of Flask and Flask V1.X.X uses the escape module from Jinja, however support for the escape module was dropped in newer versions of Jinja.
Markup and escape should be imported from MarkupSafe.
from flask import escape
was found on the page in the article It’s Time to Escape (Your Data) in the book "Head First Python, 2nd Edition" by Paul Barry, released November 2016, Publisher(s): O'Reilly Media, Inc.
No comments:
Post a Comment