READ THIS FIRST: the oddities described below are NOT present when using wxPythonGTK-py2.2-2.4.0.2-2 but are present when wxPythonGTK-py2.2-2.3.4.2-1. ------------------------------------------------------------------------- The purpous of this set of files is to illustrate an unexpected behavior of exception handling of swig wrapped c++ libraries with wxPython. Context: - g++ version 2.96 or 3.2 - swig version 1.3.16u - python2.2 Consider the code in one of the foo_main.cxx say foo_main.cxx.minimal: #include void MyWrappedFunction(void) { try { throw "In thrower"; } catch (const char * str) { cout<<"Exception"<< str << endl; } } int main() { MyWrappedFunction(); return 0; } When compiling this code and executing it one obtains the correct behavior of the exception i.e. ExceptionIn thrower. Now, wrap the above code with swig and invoque the following python script (see test.py): import wxPython.wx import foo foo.MyWrappedFunction() Surprisingly enough the exception won't be caugth, but terminate will catch it and invoke abort. Note that the exception is properly caught when one doesn't import wxPython. Note that the exception is properly caught when one doesn't import wxPython. In order to play with this example, try the following: ln -s foo_main.cxx.minimal foo_main.cxx ln -s foo.cxx.minimal foo.cxx make ./main ExceptionIn thrower python test.py