I'm seeing the following error while in debug mode only in PyCharm (pressing the 'bug' button). It does not hit the breakpoint but fails while loading the flask.exe file.
C:\ProgramData\Anaconda3\envs\workflow_webapp\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 55286 --file C:/ProgramData/Anaconda3/envs/workflow_webapp/Scripts/flask.exe run
pydev debugger: process 18788 is connecting
Connected to pydev debugger (build 183.5429.31)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\workflow_webapp\lib\tokenize.py", line 390, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py", line 1741, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 11, in execfile
stream = tokenize.open(file) # @UndefinedVariable
File "C:\ProgramData\Anaconda3\envs\workflow_webapp\lib\tokenize.py", line 454, in open
encoding, lines = detect_encoding(buffer.readline)
File "C:\ProgramData\Anaconda3\envs\workflow_webapp\lib\tokenize.py", line 431, in detect_encoding
encoding = find_cookie(first)
File "C:\ProgramData\Anaconda3\envs\workflow_webapp\lib\tokenize.py", line 395, in find_cookie
raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for 'C:/ProgramData/Anaconda3/envs/workflow_webapp/Scripts/flask.exe'
Here is the debug configuration.
The app runs fine in normal mode:
> C:\ProgramData\Anaconda3\envs\workflow_webapp\python.exe
> C:/ProgramData/Anaconda3/envs/workflow_webapp/Scripts/flask.exe run *
> Serving Flask app "workflow.py" * Environment: production WARNING:
> Do not use the development server in a production environment. Use
> a production WSGI server instead. * Debug mode: off * Running on
> http://127.0.0.1:5000/ (Press CTRL+C to quit)
The run configuration is here.
The versions are:
Python version on Windows 10: Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 18:50:55) [MSC v.1915 64 bit (AMD64)] on win32
Flask version: 1.0.2
Pycharm: 2018.3.2
Any guidance would be much appreciated.