Debugging Pycharm在调试模式下在django服务器上运行时返回非asciii错误,在正常模式下运行时工作正常

Debugging Pycharm在调试模式下在django服务器上运行时返回非asciii错误,在正常模式下运行时工作正常,debugging,pycharm,debug-mode,Debugging,Pycharm,Debug Mode,我有Django服务器在本地运行了很长一段时间。今天我突然发现运行调试模式时出现错误。它在正常模式下工作正常 我尝试在manage.py中包含utf-8,但仍然看到错误 pydev debugger: process 10424 is connecting Connected to pydev debugger (build 192.6603.34) pydev debugger: process 10425 is connecting Traceback (most recent call

我有Django服务器在本地运行了很长一段时间。今天我突然发现运行调试模式时出现错误。它在正常模式下工作正常

我尝试在manage.py中包含utf-8,但仍然看到错误

pydev debugger: process 10424 is connecting

Connected to pydev debugger (build 192.6603.34)
pydev debugger: process 10425 is connecting

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 2066, in <module>
    main()
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 2060, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1411, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1418, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python", line 1
SyntaxError: Non-ASCII character '\xcf' in file /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details```


I expect it to run on debug mode. it already bloked me 1/2 day. Please help if you already have seen this issue or know how to fix this.
pydev调试器:进程10424正在连接 已连接到pydev调试器(build 192.6603.34) pydev调试器:进程10425正在连接 回溯(最近一次呼叫最后一次): 文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py”,第2066行,在 main() 文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py”,第2060行,主目录 globals=debugger.run(setup['file'],None,None,is_模块) 文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py”,第1411行,运行中 返回self.\u exec(是模块、入口点、模块名称、文件、全局、局部) 文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py”,第1418行,in_exec pydev_imports.execfile(文件、全局、局部)#执行脚本 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python”,第1行 SyntaxError:file/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python第1行中的非ASCII字符'\xcf',但未声明编码;看见http://python.org/dev/peps/pep-0263/ 详情``` 我希望它在调试模式下运行。它已经让我恶心了半天了。如果您已经看到此问题或知道如何解决此问题,请提供帮助。
  • 操作系统:macOS 10.15.1(19B88)
  • Python:2.7.16
  • PyCharm:2019.2.3(社区版)
我的问题也是

pydev应该将exec python脚本文件解析为“-file”参数。但是当fork子进程时,它会将python二进制文件添加到“-file”args中。
天哪,处理这件事花了我很多时间。但根本原因仍未找到

您可以附加

args=args[1:][/code>

下面

从\u pydevd\u bundle.pydevd\u命令行\u处理导入设置\u到\u argv

在PyCharm安装目录中的pydev_monkey.py文件中。这可以暂时使调试功能正常


e、 g.
/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_monkey.py
在我的计算机上。

尝试使用noreload运行,当自动阅读器生成子进程时似乎失败了,因为pydev试图将python可执行文件解释为脚本

使用noreload运行可以解决“SyntaxError:文件中的非ASCII字符'\xcf'的问题”。在正常模式下运行时还有另一个问题。 语法错误:非ASCII字符“\xe6”

要定义源代码编码,必须在源文件中放置一条神奇的注释,作为文件的第一行或第二行(例如/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey.py),例如:
“#——编码:utf-8——”

我也尝试过并重新安装了pycharm。我不知道这个非ascii字符在哪里这很有帮助。谢谢
('sys.argv', ['/Volumes/128GB/tests/testweb/manage.py', 'runserver', '7000'])

Connected to pydev debugger (build 192.6817.19)

pydev debugger: process 19300 is connecting

('setup', {'multiproc': True, 'save-asyncio': False, 'vm_type': None, 'save-threading': False, 'save-signatures': False, 'multiprocess': False, 'module': False, 'server': False, 'client': '127.0.0.1', 'file': '/Volumes/128GB/tests/testweb/manage.py', 'DEBUG_RECORD_SOCKET_READS': False, 'cmd-line': False, 'print-in-debugger-startup': False, 'qt-support': '', 'port': 52573})



('sys.argv', ['/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python', '/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py', '--port', '52573', '--client', '127.0.0.1', '--multiproc', '--file', '/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python', '/Volumes/128GB/tests/testweb/manage.py', 'runserver', '7000'])

pydev debugger: process 19301 is connecting

('setup', {'multiproc': True, 'save-asyncio': False, 'vm_type': None, 'save-threading': False, 'save-signatures': False, 'multiprocess': False, 'module': False, 'server': False, 'client': '127.0.0.1', 'file': '/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python', 'DEBUG_RECORD_SOCKET_READS': False, 'cmd-line': False, 'print-in-debugger-startup': False, 'qt-support': '', 'port': 52573})