reading_ant
reading_ant

Reputation: 344

Debugging inside PyCharm IPython

Is it possible to hit graphical breakpoints when running codes in PyCharm's IPython console?

i.e.:

Upvotes: 12

Views: 4751

Answers (3)

reading_ant
reading_ant

Reputation: 344

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.

enter image description here

Upvotes: 2

Marti Nito
Marti Nito

Reputation: 814

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.

Upvotes: 1

psion5mx
psion5mx

Reputation: 83

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.

Upvotes: 1

Related Questions