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 causing Exception while handling an Exception #1050
Comments
Please provide an example to reproduce this. |
Using Python 3.5.2 this paragraph in try:
from urllib.request import parse_http_list as _parse_list_header
from urllib.parse import unquote_to_bytes as _unquote
except ImportError: # pragma: no cover
from urllib2 import parse_http_list as _parse_list_header, \
unquote as _unquote Also, the above script will complain on a deeper level without the import os
from flask import Flask
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
@app.route('/')
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run() |
Please rename your file from http.py to something else, otherwise it clashes with the http module from the stdlib. |
Apparently Python can't differentiate between scripts of the same name, so it sent me on a wild goose chase through these libraries... I appreciate the help. |
I'm new in Python, so I take the same mistake too.... |
After a bit of debugging, I have narrowed the following error down to werkzeug/http.py#L26, which gives the following exception:
ImportError: cannot import name 'parse_http_list'
. Below is the entire traceback, which involves an exception inside the exception attempting to fallback to an old python reference.The text was updated successfully, but these errors were encountered: