I am suddenly getting the following error in PyCharm whenever I try to debug my code. This seems to be happening only when I try to debug a specific project and the error doesn't seem to occur in other projects.
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 14, in <module>
from pydevd_breakpoints import * #@UnusedWildImport
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd_breakpoints.py", line 15, in <module>
from pydevd_comm import GetGlobalDebugger
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd_comm.py", line 74, in <module>
import pydevconsole
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 8, in <module>
from code import compile_command
ImportError: cannot import name compile_command
I searched around and found this answer, but it didn't work for me since I have no additional code.py
in my project.
UPDATE:
I created a new project in PyCharm and moved the files the files to the new project and was able to debug..
Just right-click any line in the editor and select the Debug <filename> command from the context menu. After the program has been suspended, use the debugger to get the information about the state of the program and how it changes during running.
Start debuggingOpen the HTML file that references the JavaScript to debug or select the HTML file in the Project tool window. From the context menu of the editor or the selection, choose Debug <HTML_file_name>. PyCharm generates a debug configuration and starts a debugging session through it.
Another breakpoint appeared as well: by default PyCharm will halt for any exception that wasn't caught in your code, and it'll show an icon of a breakpoint with a lightning bolt. The debugger also shows the error message.
Use Ctrl+F10 to open the context-menu and then select Add Breakpoint; Right-click the left bar to open the context-menu and then select Add Breakpoint; Use Ctrl+Shift+B to toggle the breakpoint in the line (if it doesn't work, go to the customize perspective and enable Breakpoints in Action Set Availability.
A directory called 'code' that had somehow acquired an empty __init__.py
file caused this for me. I suppose that's technically a module!
Edit: This happened again. Pycharm itself is creating these __init__.py
files. I haven't found out what's triggering it yet though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With