Print a traceback from an extension?
Mark Hammond
mhammond at skippinet.com.au
Sat Jul 13 21:41:09 EDT 2002
gb at cs.unc.edu wrote:
> 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?
>
> Thanks
> gb
You can find a function inside
http://lxr.mozilla.org/seamonkey/source/extensions/python/xpcom/src/ErrorUtils.cpp
that creates a traceback in your C/C++ code.
Mark.
More information about the Python-list
mailing list