[C++-sig] Getting the traceback string

yakumoklesk at yahoo.es yakumoklesk at yahoo.es
Wed Oct 8 20:27:51 CEST 2003

I am writing an application in C++ using MFCs. I huse the Boost.python 
handle_exception function to handle the function that runs the code that 
works with python, but sometimes I get errors and I want to show them 
in a messagebox because MFC applications do not have console.

I have tride to use PyErr_Fetch, but I don't know how to work with the 
PyObject of type Traceback, and I don't find documentation.

I have tried to import sys, and traceback modules, then create a 
variable traceback that gets the results of 
extract_tb(sys.last_traceback), but it seems not to work, because when 
I get the PyObject of traceback, it is NULL. I suppose there has been an 
internal error or something, but I don't know what could happen 
because I had the same code in a C++ console application and it 

If any of you have any ideas, I would appreciate them. I'll keep trying.

Thanks in advance.


More information about the Cplusplus-sig mailing list