这个是代码,正常 run 并没有问题
i = 1 result = 1 while i <= 20:
result = result * i
if i % 5 == 0:
print("{}:{}".format(i, result))
i = i + 1
1
sodadev OP D:\Anaconda\python.exe "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\pydevd.py" --multiproc --qt-support=pyside --client 127.0.0.1 --port 6835 --file D:/PythonDemo/code/cal.py
Traceback (most recent call last): File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py", line 2, in <module> 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 "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py", line 2, in <module> from code import InteractiveConsole ImportError: cannot import name 'InteractiveConsole' from 'code' (D:\PythonDemo\code\__init__.py) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\pydevd.py", line 28, in <module> from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info.py", line 17, in <module> from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py", line 32, in <module> 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 "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_breakpoints.py", line 16, in <module> from _pydevd_bundle.pydevd_comm import get_global_debugger File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 80, in <module> from _pydevd_bundle import pydevd_console_integration File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py", line 4, in <module> from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevconsole_code_for_ironpython.py", line 305 exec code in self.locals ^ SyntaxError: Missing parentheses in call to 'exec' Process finished with exit code 1 |
2
sodadev OP 大概意思是模块找不到的意思吗?
|
3
leishi1313 2019-08-06 06:39:16 +08:00 1
把你 D:\PythonDemo\code 的 code 文件夹改个名字看看
|
4
necomancer 2019-08-06 07:11:17 +08:00 1
是不是 code 是个 python 或者 pycharm 里的模块名啥的,结果你自己命名的文件夹是 code 所以出错了?你把文件夹名改了试试。
|
5
CHYK 2019-08-06 09:12:26 +08:00 1
参考这个 issue: https://github.com/Microsoft/vscode-python/issues/2836
```txt I'am teaching students and lots of them have this error. They are newbie and they don't have lot of creativity when it comes to name files... so code.py is widely use. Might be a good idea to scan working folders to detect forbidden name and throw an alert message box when detecting names crashing. No ? ``` 然而,我本地环境测试了一下,即使命名为 code.py 也没有问题。 所以我现在怀疑,你提示的这个 code 会不会和你本地的 vscode 有关系 (vscode 在命令行打开的命令就是 code) help urself. (多试试,这类问题,貌似就是环境问题) |
6
goofool 2019-08-06 09:45:58 +08:00 1
Traceback (most recent call last):
File "D:\jetbrains\PyCharm 2019.1.2\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py", line 2, in <module> from code import InteractiveConsole ImportError: cannot import name 'InteractiveConsole' from 'code' (D:\PythonDemo\code\__init__.py) |
8
sodadev OP |