I am embedding a c++ library (binding done with SIP) in my python application. Under certain circonstances (error cases), this library uses exit(), which causes my entire application to exit. 
Is there a way to catch this event, or do I need to modify the library to handle error cases differently ? 
Thank you very much,
You can override the library linking with LD_LIBRARY_PATH and make your own exit function.  Works fine.
How to catch exit() in embedded C++ module from python code?