推荐学习书目
› 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 · Aug 6, 2019 · 9240 views
    This topic created in 2607 days ago, the information mentioned may be changed or developed.

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

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

    result = result * i
    if i % 5 == 0:
        print("{}:{}".format(i, result))
    i = i + 1
    
    8 replies  •  2019-08-06 10:14:46 +08:00
    sodadev
        1
    sodadev  
    OP
       Aug 6, 2019
    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
       Aug 6, 2019
    大概意思是模块找不到的意思吗?
    leishi1313
        3
    leishi1313  
       Aug 6, 2019   ❤️ 1
    把你 D:\PythonDemo\code 的 code 文件夹改个名字看看
    necomancer
        4
    necomancer  
       Aug 6, 2019   ❤️ 1
    是不是 code 是个 python 或者 pycharm 里的模块名啥的,结果你自己命名的文件夹是 code 所以出错了?你把文件夹名改了试试。
    CHYK
        5
    CHYK  
       Aug 6, 2019   ❤️ 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  
       Aug 6, 2019   ❤️ 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
       Aug 6, 2019
    @CHYK 是文件夹名字的问题,我改了这个文件夹名字就好了。谢谢!
    sodadev
        8
    sodadev  
    OP
       Aug 6, 2019
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2413 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:26 · PVG 19:26 · LAX 04:26 · JFK 07:26
    ♥ Do have faith in what you're doing.