How to Get the Crash Errors When Embedding

Carey Evans careye at spamcop.net
Thu Sep 13 08:35:23 EDT 2001


Spam Hater <never_spam_me at yahoo.com> writes:

[...]

> My big problem for me is that when I have a python
> interpreter exception, I can't see the stack dump.

I'm not especially familiar with embedding Python, but maybe you just
need to check for the exception from your C code.  Guessing a bit here:

    /* Code that calls the Python code... */

    if (PyErr_Occurred()) {
        PyErr_Print();
        /* Any other cleanup. */
    }

You could also try putting code in the main function(s) you call that
prints the exception on its way out to the C program.  Something like:

    import traceback

    def entry_point(arg):
        try:
            real_func(arg)
        except:
            traceback.print_exc()
            raise

You might also want to have a look at the win32trace support in
win32all.  From http://www.python.org/windows/win32/ :

    To enable this debugging, simply "import win32traceutil" somewhere
    in your program - thats it! This automatically re-directs the
    standard Python output streams to the remote collector.

I hope this gives you some ideas.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	You think you know... what's to come... what you are.



More information about the Python-list mailing list