delayed sys.exit?

Stephen Hansen apt.shansen at
Wed Jul 29 16:36:32 EDT 2009

> In the attached
> code,
> it appears that additional statements execute after the call to
> sys.exit(0).
> I'll be grateful if anyone can shed light on why this is happening.  Below
> is a copy of some sample I/O.  Note that in the last case I get additional
> output after what should be the final error message.

A bare "except:" catches ALL exceptions; including SystemExit which is
generated by
sys.exit. And KeyboardInterrupt, too. That's why its basically a bad
idea to use bare excepts unless you really, really, really need to.
Try 'except Exception' instead. SystemExit and such do not inherit
from Exception.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list