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

Flask-Login cannot import name "parse rule' from 'werkzeug.routing' #2464

Closed
MuNeNICK opened this issue Jul 24, 2022 · 3 comments
Closed

Flask-Login cannot import name "parse rule' from 'werkzeug.routing' #2464

MuNeNICK opened this issue Jul 24, 2022 · 3 comments

Comments

@MuNeNICK
Copy link

MuNeNICK commented Jul 24, 2022

I developed an application with Flask and got the following error.

File "/usr/local/lib/python3.9/site-packages/flask_login/utils.py", line 14, in <module>
from werkzeug. routing import parse rule
ImportError: cannot import name
"parse rule' from 'werkzeug.routing'(/usr/local/lib/python3.9/site-packages/werkzeug/routing/__init__.py)

However, when I downgraded the werkzeug version to 2.1.2, the error did not occur.

Environment:

  • Python version:3.9
  • Flask version:2.0.1 and 2.1.3
  • Werkzeug version:2.2.0
@MuNeNICK MuNeNICK changed the title  ImportError: cannot import name "parse rule' from 'werkzeug.routing' ImportError: cannot import name "parse rule' from 'werkzeug.routing' Jul 24, 2022
@ThiefMaster
Copy link
Member

ThiefMaster commented Jul 24, 2022

parse_rule was marked as internal, and due to changes in 2.2 (most likely in #2433) it no longer exists as a global function.

PS: Did you type that error message manually? It does NOT look like something copy-pasted. In this case it was still somewhat clear, but there are other errors people report where lack of details or full tracebacks are an issue. So it's better to always parse full errors when reporting something.

@ThiefMaster ThiefMaster closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2022
@bruntonspall
Copy link

It looks like the flask_login package was using parse_rule, it's just broken in a bit of my code as well.

This looks to have been opened here: maxcountryman/flask-login#686 but since the import error is thrown from WerkZeug, people may come here first.

bruntonspall added a commit to bruntonspall/links that referenced this issue Jul 24, 2022
@bbnil
Copy link

bbnil commented Jul 25, 2022

also affects flask-restx
python-restx/flask-restx#460

@davidism davidism changed the title ImportError: cannot import name "parse rule' from 'werkzeug.routing' Flask-Login cannot import name "parse rule' from 'werkzeug.routing' Jul 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 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

4 participants