Via IPython and ipdb

suggest change

The 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents