During dubugging ipython console freezes after second call (pycharm 2016.2)

Answered

 

When entering the ipython console in Pycharm 2016.2 during debugging, the console freezes after the second input. This is not a problem in Pycharm 2016.1.4

Setup: Pycharm 2016.2, Ubuntu 14.04, python 2.7 or python 3.4,  ipython 4.2.0 or ipython 5.0.0

E.g. given a file test.py:

x=1

y=2

z=3

 

During debugging, the pydev will produce a result for the fir output but will hang on the second output, e.g:

Connected to pydev debugger
>>> x
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
Out[1]: 1
>>> y

 

 

2 comments
Comment actions Permalink
Official comment

Hi! It's a known issue in our tracker: https://youtrack.jetbrains.com/issue/PY-20005 The fix will appear in PyCharm 2016.2.2 update.

The problem exists when the debugger is stopped at breakpoint with the "All" thread suspend policy. It happens because we're trying to suspend all threads including some internal IPython threads and that leads to the hanging. Workaround is to change thread suspend policy for your breakpoints to "Thread".

Breakpoint's thread suspend policy has appeared in PyCharm 2016.2. You should go Run | View breakpoints, select the breakpoint and select its threads suspend policy "All" or "Thread".
"Thread": when the breakpoint is hit, the thread where the breakpoint is hit is suspended.
"All": when a breakpoint is hit, all threads are suspended.

In the previous versions of PyCharm the default policy used to be "Thread", but it's become "All" since PyCharm 2016.2. When you change breakpoint's policy, the button "Make default" appears and you can save new default policy for all your breakpoints.

Comment actions Permalink

Thanks. The workaround does the trick.

0

Please sign in to leave a comment.