Hang after running pdb in a cell, Kernel/Interrupt doesn't help
See original GitHub issueIf you debug a cell via pdb, then don’t quit it before rerunning the cell, you can’t get back to your IPython environment. Reproduce it via Test case for pdb hang in Jupyter notebook. Here’s a screenshot:
For the record and search engines, to hang your notebook:
- Run the following cell
- Do not “quit” via the pdb prompt
- Then run it again.
def test():
import pdb; pdb.set_trace() # XXX BREAKPOINT
return 0
test()
Note that Kernel/Interupt doesn’t help. You can save the notebook, but to run cells again, you need to restart the kernel, at which point “All variables will be lost”
This happens to me not infrequently if I am searching thru the rest of the notebook for hints on how to debug the cell, then forget to quit before changing the cell and running it again. Yes, I can be more careful, but others have the same experience. Thanks to @wmayner for a convenient test case described at #3400.
I’m running Jupyter notebook 4.3.1 on Python 3.4.3 (default, Nov 17 2016, 01:08:31) [GCC 4.8.4] Kernel Information: Python 3.4.3 (default, Nov 17 2016, 01:08:31)
Input from @takluyver at #10499
pdb runs in the same process, and we do know when it’s expecting input. I think it needs someone to do the work so that when the HTML input box is removed in the frontend, a message is sent back to the kernel which will raise EOFError. That may need a new message type, or we could do it as a metadata field on the existing stdin reply message.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:73
- Comments:34 (9 by maintainers)
Just got bitten by this as well. How do people typically debug in jupyter notebook? Using pdb is like juggling a grenade 😦
I am running into the same problem.