Issue
I try to customize behavior of sys.excepthook
as described by the recipe.
in ipython:
:import pdb, sys, traceback
:def info(type, value, tb):
: traceback.print_exception(type, value, tb)
: pdb.pm()
:sys.excepthook = info
:--
>>> x[10] = 5
-------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
NameError: name 'x' is not defined
>>>
pdb.pm()
is not being called. It seems that sys.excepthook = info
doesn't work in my python 2.5 installation.
Solution
ipython, which you're using instead of the normal Python interactive shell, traps all exceptions itself and does NOT use sys.excepthook. Run it as ipython -pdb
instead of just ipython
, and it will automatically invoke pdb upon uncaught exceptions, just as you are trying to do with your excepthook.
Answered By - Alex Martelli
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.