I can run the code but cannot debug in pycharm on Mac OS

Completed

/anaconda3/python.app/Contents/MacOS/python "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py" --multiproc --client 127.0.0.1 --port 52651 --file /Users/yumi/Documents/Code/Continuous-learning/offer/offer.py
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 2, 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 "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 28, in <module>
from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info.py", line 12, in <module>
from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport @Reimport
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info_regular.py", line 7, in <module>
from _pydevd_bundle.pydevd_frame import PyDBFrame
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_frame.py", line 10, in <module>
from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_breakpoints.py", line 16, in <module>
from _pydevd_bundle.pydevd_comm import get_global_debugger
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 80, in <module>
from _pydevd_bundle import pydevd_console_integration
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 4, in <module>
from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevconsole_code_for_ironpython.py", line 105
except SyntaxError, err:
^
SyntaxError: invalid syntax

Process finished with exit code 1

 

 

when I try to debug the code to see what's going on in this code, it didn't work and its shows something wrong in the pydev.. files.Also it shows "Connection to Python debugger failed: Socket closed". My Python uses Anaconda 3.4, what's more,I tried python 2.7, it doesn't work as well.

What shoud i do?pls  help me 

0
4 comments
Avatar
Permanently deleted user

i got the reason. That's because I have a file named "code.py"......

3

You are right. Having custom module which has the same name as some standard python module may cause this.

1

THANK YOU @...!!! This was exactly my problem and fixed it!

0

Thank you, i had the directory named as "code", that was the error

0

Please sign in to leave a comment.