Re: Printing the exception traceback in C code
Mark Hammond (mjh@cmutual.com.au)
Thu, 18 Aug 1994 23:41:58 GMT
>From article <1994Aug17.180159.150@sdav01.seinf.abb.se>, by dlarsson@sw.seisy.abb.se (Daniel Larsson):
> I call a python function from C (call_object), which sometimes raises an
> exception. How do I get hold of the exception's trace back from the
> C function?
>
The easiest way is to call the Python print_error function.
Otherwise...
After an exception, the exception values are stored in attributes of the
sys module.
The easiest way to access a traceback is to write Python code to look at
the sys variables. Accessing these variables in C, and walking the
list would be a bit painful
After you C code detects an exception, you could simply then call your Python code
to handle/print/whatever it.
Mark.