[C++-sig] Re: how to get python expection infomation in c++?

Ingo Luetkebohle ingo at fargonauten.de
Thu Apr 8 13:57:02 CEST 2004

Am Do, den 08.04.2004 schrieb Pierre Barbier de Reuille um 13:41:
> My point was about getting the error message not printed in stderr
> (because I have a GUI and reporting the error must be done in it). As
> PyErr_Print() writes its message to sys.stderr, the only way I found to
> get the message is to redirect sys.stderr to a pipe and to read this
> pipe. I event looked into Python code to see if there were a function to
> write the error where I want it to, but I didn't find any !

Check out the source code for PyErr_Print (from Python).  Its simply a
convenience function to inspect the python traceback object.  All the
information is available with other Python/C calls and you can print it

Its slightly more effort, but might come in handy if you want to have
just part of the trace or somesuch.



Soll doch jeder bleiben, wie er gerne wäre.

More information about the Cplusplus-sig mailing list