Error handling. Python embedded into a C++ app.
Wolfram
Wolfram at invalid.invalid
Wed Nov 29 08:33:47 EST 2006
"Eric_Dexter at msn.com" <Eric_Dexter at msn.com> wrote:
>You would use try: and then on the next line except:
Thanks for the idea, but it did not help. I can not wrap every pythion
line in python, so I wrote the following code on the C++ side:
-------------- snip -----------------
try
{
int ret = PyRun_SimpleString ( p ) ;
if(ret==-1)
{
::MessageBox(0, "Error in Python call!", "", 0);
}
else
{
assert(ret == 0);
}
}
catch( ...) {
::MessageBox(0, "exception", "", 0 );
}
-------------- snip -----------------
I call this where "p" is an "execute" of a *.py file containing an
error. I get the "Error in Python call!", but not the "exception".
Any help, including links to information, welcome.
TIA, Wolfram Kuss.
More information about the Python-list
mailing list