Catching SystemExit in C API code when embedding Python?

Stefan Bellon sbellon at sbellon.de
Thu Aug 2 14:19:06 CEST 2007


Hi all!

I am embedding Python into a GUI application in a way that the GUI is
scriptable using Python.

Now I have come to a problem that when the user puts a "sys.exit(0)"
into his script to end the script, not only the script is terminated,
but also the GUI application itself. This is not the intended behaviour.

As in Python itself you can catch SystemExit, I think this should be
the way to go. But how do I catch this exception from within the C API?

Thanks in advance for any hints.

-- 
Stefan Bellon



More information about the Python-list mailing list