Is it possible to hit graphical breakpoints when running codes in PyCharm's IPython console?
i.e.:
- You have a script foo() in foo.py
- You place a graphical breakpoint inside foo() from the editor (the red dot next to line number)
- You import foo into a PyCharm's IPython console and execute foo() (Note: not running from a debug configuration!)
Yes, it is. But it is not automatic.
(Using 4.5.2, Windows 8)
I run an IPython Notebook, and let PyCharm kick off the notebook backend.
I hit Tools, Attach to Process and attempt to identify the PID of the notebook process. I'm yet to find a smooth way of doing this. Currently I use Process Explorer, find the pycharm entry, and watch for the new sub-processes after the notebook server starts. You want the leaf python.exe process, e.g:
6268 pycharm.exe
1235 python.exe (new when notebook launched)
7435 conhost.exe (new)
9237 python.exe (new - pick this PID)
I can now run a cell and hit the graphical breakpoints.
Enjoy.
On ubuntu i had to change the line kernel.yama.ptrace_scope = 1
in /etc/sysctl.d/10-ptrace.conf
to kernel.yama.ptrace_scope = 0
otherwise pycharm was not able to attach to the ipython process.
As suggested by @bvanlew in comments, PyCharm (both community and professional edition) now supports attaching debugger onto interactive console. Click the debug button as shown below, and PyCharm's debugger will kick in when the breakpoint is hit.