[Pythonmac-SIG] sys.exit() functionality

Jack Jansen jack@oratrix.com
Wed, 30 Jan 2002 15:29:21 +0100


On Tuesday, January 29, 2002, at 08:54 , Jon Bradley wrote:

> hey all,
>
> In embedded Python - why does sys.exit() quit out of the application 
> that's
> embedding the interpreter?  Is there any way to trap or disregard this?
>
> If a user creates an application with Python and runs it through the
> embedded interpreter, calling quit or exit on the Python application 
> itself
> is more than ok, but allowing it to force out of the parent application
> isn't.

Sounds reasonable. How about a routine PyMac_SetExitFunc() that you 
could call to set your own exit function, (similar to 
PyMac_SetConsoleHandler())? MacPython would then do all it's normal 
cleanup, but at the very end call your routine in stead of exit().
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -