我从Mac OS的official "pkg" bundle安装了Python 3.6rc1。现在,每次我在PyCharm中使用“调试”运行配置(不依赖于特定脚本)时,都会收到包含以下错误消息的大堆栈跟踪(连续抛出多次):
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_signature.py", line 88, in create_signature
filename, modulename, funcname = self.file_module_function_of(frame)
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_signature.py", line 102, in file_module_function_of
modulename = trace.modname(filename)
AttributeError: module 'trace' has no attribute 'modname'
使用最新的PyCharm 2016.3。请注意,我可以使用相同的PyCharm实例使用Python 2.7或3.5进行调试,而不会出现任何问题。
有没有人经历过这样的事情?有解决方法吗?
在SO上发帖,因为我不能完全确定这实际上是一个错误,或者我配置错误。另外,我知道PyCharm小组会在此处检查
pycharm
标签;与其他人相比,在PyCharm的错误跟踪器上查找此主题会更容易。 最佳答案
在PyCharm的bug中实际上有一个 PyDev.Debugger
,它使用了Python 3.2以来不存在的trace.modname
:
def file_module_function_of(self, frame): #this code is take from trace module and fixed to work with new-style classes
code = frame.f_code
filename = code.co_filename
if filename:
modulename = trace.modname(filename) # < HERE
else:
modulename = None
# ...
现在,仅当使用
--save-signatures
命令行选项启动调试器时才执行此特定代码,该选项由“收集运行时类型信息以进行代码洞察” Python调试器设置启用:关闭设置,该错误将消失。