Catching Python exceptions from C++ ...

Alex Walsh alexwalsh at accesswave.ca
Wed Jul 4 04:50:34 CEST 2001


Hi all!

I have embedded Python in my C++ application and fire off a script by
calling the PyRun_SimpleFileExFlags() function.

The problem is that it only returns a bool to indicate failure. I have
no way of knowing what caused it.

So, I have two questions:
1. How can I extract the exception that caused the script problem from
this function?
2. Can I perhaps set stdin, stdout, stderr to my own FILE handles and at
least dump the output/trace info to something I can read later? If so,
how?

Thanx in advance,
Sandy



More information about the Python-list mailing list