Flask Debug/Run Config issue with Python 3.6


I'm busy setting up a Flask app with a Flask server Debug/Run Configuration. Everything works perfectly with a small hello world Flask app in Python 2.7.10, but if I change to Python 3.6.5 I get the following error when trying to run or debug the app.


FLASK_APP = hello.py
FLASK_ENV = development
In folder /Users/gpriday/Dropbox/Python/postcontent
/Users/gpriday/Dropbox/Python/postcontent/venv3/bin/python -m flask run
Failed to import the site module
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 544, in <module>
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 527, in main
known_paths = venv(known_paths)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 464, in venv
addsitepackages(known_paths, [sys.prefix])
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 326, in addsitepackages
for sitedir in getsitepackages(prefixes):
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 317, in getsitepackages
framework = get_config_var("PYTHONFRAMEWORK")
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 601, in get_config_var
return get_config_vars().get(name)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 580, in get_config_vars
import _osx_support
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_osx_support.py", line 4, in <module>
import re
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Process finished with exit code 1



I'd ideally like to be able to use the debug/run configuration during development. Is there anything I'm missing?

I was able to run the app using `flask run` in terminal.

1 comment


Which Flask version do you use? Please try to runing ``/Users/gpriday/Dropbox/Python/postcontent/venv3/bin/python -m flask run`` in terminal. Does it work?


Please sign in to leave a comment.