V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
sodadev
V2EX  ›  Python

新手求助, PycharmDebug 模式报错 Traceback (most recent call last)

  •  
  •   sodadev · 2019-08-06 06:33:22 +08:00 · 8185 次点击
    这是一个创建于 1938 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这个是代码,正常 run 并没有问题

    i = 1 result = 1 while i <= 20:

    result = result * i
    if i % 5 == 0:
        print("{}:{}".format(i, result))
    i = i + 1
    
    8 条回复    2019-08-06 10:14:46 +08:00
    sodadev
        1
    sodadev  
    OP
       2019-08-06 06:33:55 +08:00
    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
    sodadev
        2
    sodadev  
    OP
       2019-08-06 06:34:51 +08:00
    大概意思是模块找不到的意思吗?
    leishi1313
        3
    leishi1313  
       2019-08-06 06:39:16 +08:00   ❤️ 1
    把你 D:\PythonDemo\code 的 code 文件夹改个名字看看
    necomancer
        4
    necomancer  
       2019-08-06 07:11:17 +08:00   ❤️ 1
    是不是 code 是个 python 或者 pycharm 里的模块名啥的,结果你自己命名的文件夹是 code 所以出错了?你把文件夹名改了试试。
    CHYK
        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. (多试试,这类问题,貌似就是环境问题)
    goofool
        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)
    sodadev
        7
    sodadev  
    OP
       2019-08-06 10:14:16 +08:00
    @CHYK 是文件夹名字的问题,我改了这个文件夹名字就好了。谢谢!
    sodadev
        8
    sodadev  
    OP
       2019-08-06 10:14:46 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5627 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 08:13 · PVG 16:13 · LAX 00:13 · JFK 03:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.