仅在PyCharm中,在调试模式下我看到以下错误(按“错误”按钮)。它没有达到断点,但是在加载flask.exe文件时失败。
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'
该应用在正常模式下运行正常:
> 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)
版本为:
Python版本:Python 3.6.8 | Anaconda,Inc. | (默认值,2018年12月30日,18:50:55)在Win32上的[MSC v.1915 64位(AMD64)]
烧瓶版本:1.0.2
Pycharm:2018.3.2
任何指导将不胜感激。