Print a traceback from an extension?

Chris Liechti cliechti at gmx.net
Sat Jul 13 19:46:51 EDT 2002


gb at cs.unc.edu wrote in news:u1ya7cj4b.fsf at cs.unc.edu:

> Can I print a traceback from within a extension written in C? 
> 
> I know we're supposed to just keep returning NULL until we make it
> back to the main loop. That normally works fine. 
> 
> But I'm calling Python code from a callback that is called by C
> code. The Python code fails so PyEval_CallObject returns NULL. I want
> to provide a helpful message at that point.
> 
> Can this be done? If so, can someone suggest where to look for an
> example?

PyErr_Print() for example.

look here whats possible otherwise:
http://python.org/doc/current/api/exceptionHandling.html

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list