[C++-sig] Help needed with simple boost.python exception handler

David Aldrich David.Aldrich at EU.NEC.COM
Thu Jul 22 15:57:04 CEST 2010


Hi

I want to add a simple exception handler to my boost.python application. I want it to print a simple message to the console, indicating the nature of the error.

I have seen:

try {
    ...
} catch ( error_already_set ) {
    PyErr_Print();
}

But is there a better solution using a boost.python method instead of  PyErr_Print() ?

Or, can I do something like the following?

catch ( const error_already_set& e ) {
    cout << e.what();
}

Best regards

David


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100722/a0767730/attachment.html>


More information about the Cplusplus-sig mailing list