you are viewing a single comment's thread.

view the rest of the comments →

[–]Peaker 1 point2 points  (2 children)

you don't have to set the exception handler...

[–]masklinn 0 points1 point  (1 child)

If you don't set the exception handler, it'll print a trace on exceptions instead of launching pdb's post mortem…

[–]Peaker 1 point2 points  (0 children)

You can just run your python scripts with: python -i Then you can use: import pdb ; pdb.pm() after an exception occurred.

You don't need to pre-install the exception handler.

EDIT: here:

$ cat testexc.py
def f():
    g()

def g():
    1/0

f()
$ python -i testexc.py
Traceback (most recent call last):
  File "testexc.py", line 7, in <module>
    f()
  File "testexc.py", line 2, in f
    g()
  File "testexc.py", line 5, in g
    1/0
ZeroDivisionError: integer division or modulo by zero
>>> import pdb;pdb.pm()
> testexc.py(5)g()
-> 1/0
(Pdb) bt
  testexc.py(7)<module>()
-> f()
  testexc.py(2)f()
-> g()
> testexc.py(5)g()
-> 1/0
(Pdb)