feature proposal, debug on exception

Simon Forman sajmikins at gmail.com
Wed May 21 01:18:59 EDT 2008


On May 20, 5:59 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> There's an occasional question here about how to get python to launch
> pdb on encountering an uncaught exception.  The answer is to look in
> some ASPN recipe and do some weird magic.  I guess that works, but
> it's another thing to remember or keep looking up when the occasion
> arises (some program crashes unexpectedly).  I find myself manually
> adding tracing instead, finding out that I did it wrong and having to
> re-launch a long-running program, etc.
>
> I'd like to propose that debug-on-exception be made into a standard
> feature that is easy to enable, e.g. with a command line option
> or with a simple pdb call immediately after the import:
>
>   import pdb
>   pdb.debug_on_exception(True)
>   ...
>
> Would there be big obstacles to this?  It would have saved me
> considerable hassle on a number of occasions.  I'm constantly
> processing large data sets that will munch along happily for hours and
> hours before hitting some unanticipated condition in the data, and it
> would be great to trap immediately rather than have to analyze the
> resulting stack dump and restart.


This is not exactly an answer to your proposal, I know, but FWIW
Ipython has exactly this capability.

Regards,
~S



More information about the Python-list mailing list