Stopping exception unwinding at exit

Michael Hudson mwh at
Wed Nov 14 11:34:12 CET 2001

"Sean 'Shaleh' Perry" <shalehperry at> writes:

> On a related note, is there a way to tell python to NEVER drop a trace?  

Assign to sys.excepthook?  It's fairly new.

> Even if I have a global exception handler I find I can hit control-C
> in the time between starting a script and the script executing.
> This of course leads to a trace and looks quite ugly.

Or you could install a handler for SIGINT.

Of course, if you can hit ^C *really* quickly, you can do it before
you can do either of these things.

I don't think there's a startup option that suppresses tracebacks by

If for some reason this is really important you could probably write a
C wrapper that plays sigaction games.


  In case you're not a computer person, I should probably point out
  that "Real Soon Now" is a technical term meaning "sometime before
  the heat-death of the universe, maybe".
                                     -- Scott Fahlman <sef at>

More information about the Python-list mailing list