sys.exit versus termination of source code

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


Hi,

 

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

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
applications.

Is there a way to determine in an exithandler (that is registered using
atexit.register)

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 =
myfunction

Is that a wise idea?

 

Thanks

Carl D'Halluin

www.qlayer.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070712/480d35a9/attachment.html>


More information about the Python-list mailing list