gouthambs / Flask-Blogging

A Markdown Based Python Blog Engine as a Flask Extension.
http://flask-blogging.readthedocs.org/en/latest/
MIT License
688 stars 159 forks source link

ImportError: cannot import name 'escape' from 'werkzeug.utils' #158

Open sungakim816 opened 2 years ago

sungakim816 commented 2 years ago

Encountered on flask run command

Traceback (most recent call last): File "C:\Users\sunga.virtualenvs\spaceflask-ZdvwGELI\lib\site-packages\flask\cli.py", line 234, in locate_app import(module_name) File "C:\Users\sunga\Documents\Repositories\spaceflask\spaceflask\app.py", line 51, in blog_engine.init_app(app=app, storage=sql_storage) File "C:\Users\sunga.virtualenvs\spaceflask-ZdvwGELI\lib\site-packages\flask_blogging\engine.py", line 98, in init_app from .views import create_blueprint File "C:\Users\sunga.virtualenvs\spaceflask-ZdvwGELI\lib\site-packages\flask_blogging\views.py", line 13, in from feedwerk.atom import AtomFeed File "C:\Users\sunga.virtualenvs\spaceflask-ZdvwGELI\lib\site-packages\feedwerk\atom.py", line 25, in from werkzeug.utils import escape ImportError: cannot import name 'escape' from 'werkzeug.utils' (C:\Users\sunga.virtualenvs\spaceflask-ZdvwGELI\lib\site-packages\werkzeug\utils.py)

mar1ad commented 2 years ago

apparently werkzeug deprecated werkzeug.utils.escape in v2.0.0 [1] and removed it in v2.1.0 [2]. The changelog says: "Remove escape and unescape. Use MarkupSafe instead."

A temporary workaround would be to use werkzeug<2.1.0

[1] https://github.com/pallets/werkzeug/commit/e13b8fba7ddc0d56b1266f439a190dd11aa40c0d [2] https://werkzeug.palletsprojects.com/en/2.1.x/changes/#version-2-1-0%20[3]%20https://github.com/crossbario/crossbar/pull/1974

mar1ad commented 2 years ago

Created PR with project https://github.com/uniphil/feedwerk/pull/2

uniphil commented 2 years ago

Fixes should be live in feedwerk == 1.1.0!

mar1ad commented 2 years ago

A fresh install, with Werkzeug==2.1.2 and feedwerk==1.1.0, works. Thanks @sungakim816 for reporting and @uniphil for the quick release.

@gouthambs, this issue can be closed.