os._exit vs. sys.exit

Andrew Dalke dalke at dalkescientific.com
Fri Jul 29 08:28:26 CEST 2005


Bryan wrote:
> Why does os._exit called from a Python Timer kill the whole process while 
> sys.exit does not?  On Suse.

os._exit calls the C function _exit() which does an immediate program
termination.  See for example
  http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/_exit.2.html
and note the statement "can never return".

sys.exit() is identical to "raise SystemExit()".  It raises a Python
exception which may be caught at a higher level in the program stack.

				Andrew
				dalke at dalkescientific.com





More information about the Python-list mailing list