Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

python - Strange error while using Pycharm to debug PyQt gui

I've been using PyCharm to debug my gui in PyQt. This has been really successful thus far, until I've run into a strange error in trying to debug my gui just now. I've set a breakpoint at the beginning of the script as well as at various points but the program does not have a chance to get to this point. I've also tried removing all the breakpoints and running the debug but get the same result. The full traceback is:

C:UserspbreachContinuumAnaconda3python.exe "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydevpydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 53720 --file C:/Users/pbreach/Dropbox/FIDS/cci/bluebook/code/input.py
Traceback (most recent call last):
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevd_cython_wrapper.py", line 2, in <module>
    from _pydevd_bundle.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo
ModuleNotFoundError: No module named '_pydevd_bundle.pydevd_cython'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydevpydevconsole.py", line 8, in <module>
    from code import InteractiveConsole
ImportError: cannot import name 'InteractiveConsole'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydevpydevd.py", line 26, in <module>
    from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevd_additional_thread_info.py", line 17, in <module>
    from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevd_cython_wrapper.py", line 26, in <module>
    mod = __import__(check_name)
  File "_pydevd_bundlepydevd_cython_win32_36_64.pyx", line 9, in init _pydevd_bundle.pydevd_cython_win32_36_64 (_pydevd_bundle/pydevd_cython_win32_36_64.c:21388)
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevd_frame.py", line 10, in <module>
    from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevd_breakpoints.py", line 15, in <module>
    from _pydevd_bundle.pydevd_comm import get_global_debugger
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevd_comm.py", line 75, in <module>
    import pydevconsole
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydevpydevconsole.py", line 10, in <module>
    from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
  File "C:Program Files (x86)JetBrainsPyCharm Community Edition 2016.3helperspydev\_pydevd_bundlepydevconsole_code_for_ironpython.py", line 105
    except SyntaxError, err:
                      ^
SyntaxError: invalid syntax

Process finished with exit code 1

Does anyone know what is causing this error and how it can be resolved? When I run the code normally (without debugging) I do not run into any of these errors.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I ran into the same issue, and it took me a while but I found a solution that works for me. I believe what happens, is that the debugger is looking for the module _pydevd_bundle.pydevd_cython in a directory code. However, because you are running the script out of your own code directory, the debugger checks your folder, sees their is no module, and throws the error. That would explain why deleting the __init__.py works, because the debugger won't confuse the two directories anymore.

So, renaming your code directory to something else, should fix the issue and let you keep the init file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...