sys.exit versus termination of source code

Carl DHalluin carl.dhalluin at
Thu Jul 12 00:00:51 CEST 2007



I am playing with the atexit module but I don't find a way to see the

between a script calling sys.exit(<returncode>) and the interpreting
arriving at the end

of the source code file. This has a semantic difference for my

Is there a way to determine in an exithandler (that is registered using

how I exited?


Second question: is there a way to determine in my exithandler what the
return code was.

atexit doesn't seem to support that


Third question: I can solve part of my problem by reassigning sys.exit =

Is that a wise idea?



Carl D'Halluin

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

More information about the Python-list mailing list