Reputation: 161
I've been trying to run a simple flask app but I'm getting the following error.
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
I'm running it as python app.py, sudo python app.py but the same error is always popping up
Traceback (most recent call last):
File "app.py", line 1, in <module>
from flask import Flask
File "/usr/local/lib/python2.7/site-packages/flask/__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "/usr/local/lib/python2.7/site-packages/werkzeug/__init__.py", line 152, in <module>
__import__('werkzeug.exceptions')
File "/usr/local/lib/python2.7/site-packages/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/usr/local/lib/python2.7/site-packages/werkzeug/wrappers.py", line 26, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "/usr/local/lib/python2.7/site-packages/werkzeug/http.py", line 26, in <module>
from urllib2 import parse_http_list as _parse_list_header
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 94, in <module>
import httplib
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1230, in <module>
import ssl
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 133, in <module>
PROTOCOL_SSLv23 = PROTOCOL_TLS
NameError: name 'PROTOCOL_TLS' is not defined
Help is appreciated, thanks!
Upvotes: 0
Views: 2409
Reputation: 3297
This error appears to occur when a you have an outdated OpenSSL or PyOpenSSL version. Updating PyOpenSSL should fix this issue:
pip install --upgrade pyopenssl
Upvotes: 1
Reputation: 161
Completely uninstalled python and all it's dependencies and it worked.
Upvotes: 1