Via IPython and ipdb
suggest changeThe snippet below needs the separate ipdb package. IPython or Jupyter being installed does not by itself provide ipdb. Invoke it with:
import ipdb
ipdb.set_trace()
When reached, the code will pause and print:
/home/usr/ook.py(3)<module>()
1 import ipdb
2 ipdb.set_trace()
----> 3 print("Hello world!")
ipdb>
Clearly, this means that one has to edit the code. There is a simpler way:
import sys
from IPython.core import ultratb
sys.excepthook = ultratb.FormattedTB(mode='Verbose',
color_scheme='Linux',
call_pdb=1)
This will cause the debugger to be called if there is an uncaught exception raised.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents