PyCharm调试器不起作用

时间:2016-04-04 13:14:06

标签: python python-3.x debugging ide pycharm

我刚刚下载了PyCharm社区版,每次我尝试在PyCharm中调试任何Python程序时,都会收到此错误:

C:\Python31\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community 
Edition 2016.1\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 59207 --file C:/Users/Gal/PycharmProjects/untitled/test.py
pydev debugger: process 5388 is connecting

Connected to pydev debugger (build 145.260)
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1\helpers\pydev\pydevd.py", line 1530, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1\helpers\pydev\pydevd.py", line 937, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 11, in execfile
    stream = tokenize.open(file)  # @UndefinedVariable
AttributeError: 'module' object has no attribute 'open'

并打开一个名为“_pydec_excecfile.py”的python文件:

#We must redefine it in Py3k if it's not already there
def execfile(file, glob=None, loc=None):
    if glob is None:
        import sys
        glob = sys._getframe().f_back.f_globals
    if loc is None:
        loc = glob
# It seems that the best way is using tokenize.open(): http://code.activestate.com/lists/python-dev/131251/
import tokenize
stream = tokenize.open(file)  # @UndefinedVariable
try:
    contents = stream.read()
finally:
    stream.close()

#execute the script (note: it's important to compile first to have the filename set in debug mode)
exec(compile(contents+"\n", file, 'exec'), glob, loc)

我该如何解决?

0 个答案:

没有答案