Enter post-mortem debugging of the traceback found in sys.last_exc.
>>> import pdb >>> def f(x): ... print(1 / x) ... >>> f(0) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in f ZeroDivisionError: division by zero >>> pdb.pm() > <stdin>(2)f() (Pdb) p x 0 (Pdb)
pdb/pm
pm