【Python】代码可以运行,但不能debug

Traceback (most recent call last):
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev_pydevd_bundle\pydevd_cython_wrapper.py”, line 2, in
from _pydevd_bundle_ext.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, global_cache_skips, global_cache_frame_skips
ModuleNotFoundError: No module named ‘_pydevd_bundle_ext’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev\pydevconsole.py”, line 8, in
from code import InteractiveConsole
ImportError: cannot import name ‘InteractiveConsole’ from ‘code’ (E:\code\code.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev\pydevd.py”, line 28, in
from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev_pydevd_bundle\pydevd_additional_thread_info.py”, line 17, in
from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev_pydevd_bundle\pydevd_cython_wrapper.py”, line 32, in
mod = import(check_name)
File “_pydevd_bundle\pydevd_cython_win32_37_64.pyx”, line 139, in init _pydevd_bundle.pydevd_cython_win32_37_64
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev_pydevd_bundle\pydevd_breakpoints.py”, line 16, in
from _pydevd_bundle.pydevd_comm import get_global_debugger
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev_pydevd_bundle\pydevd_comm.py”, line 82, in
import pydevconsole
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev\pydevconsole.py”, line 10, in
from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
File “C:\【软件】\PyCharm 2018.2.2\helpers\pydev_pydevd_bundle\pydevconsole_code_for_ironpython.py”, line 105
except SyntaxError, err:
^
SyntaxError: invalid syntax

会发生以上报错。

原因是因为我当前目录下有一个叫做code.py的文件,所以python就找不到他原本的code模块了,解决办法也很简单,改一下文件名就好了,以后文件夹名字、文件名尽量避免这类命名。

你可能感兴趣的:(Python)