Issue
import config
from server import app
Config = config.Config()
ipServer = Config.ipServer
portServer = Config.portServer
debug = Config.debug
if __name__ == '__main__':
app.run(debug=debug, host=ipServer, port=portServer)
This is main.py file whenever I run python main.py
I get this error which I cannot understand at all, please help me find my mistake.
Traceback (most recent call last):
File "/home/abledtaha/Projects/upm/upm_server/src/main.py", line 2, in <module>
from server import app
File "/home/abledtaha/Projects/upm/upm_server/src/server.py", line 3, in <module>
from flask import Flask
File "/home/abledtaha/anaconda3/envs/upm_server/lib/python3.12/site-packages/flask/__init__.py", line 7, in <module>
from .app import Flask as Flask
File "/home/abledtaha/anaconda3/envs/upm_server/lib/python3.12/site-packages/flask/app.py", line 27, in <module>
from . import cli
File "/home/abledtaha/anaconda3/envs/upm_server/lib/python3.12/site-packages/flask/cli.py", line 17, in <module>
from .helpers import get_debug_flag
File "/home/abledtaha/anaconda3/envs/upm_server/lib/python3.12/site-packages/flask/helpers.py", line 14, in <module>
from werkzeug.urls import url_quote
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/home/abledtaha/anaconda3/envs/upm_server/lib/python3.12/site-packages/werkzeug/urls.py). Did you mean: 'unquote'?
It is an old project of mine which I last ran on my Windows about a year ago maybe but have no idea what is going on now even though I did not make any changes.
Solution
The error seems to be related to a version mismatch or change in the Flask and Werkzeug libraries. The url_quote
function appears to have been removed in newer versions of Werkzeug.
You can try to upgrade Flask:
pip install --upgrade flask
or downgrade Werkzeug:
pip install werkzeug==0.16.0
to see if that resolves the error.
Answered By - Jake Zappin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.