[C++-sig] Have error_already_set - now what?
Johan Johansson
johan2sson at gmail.com
Thu Jan 11 18:50:38 CET 2007
Hi everyone
It's probably just me missing something obvious, but I'm having a very hard
time to get a useful error message when I catch an error_already_set in code
calling a python function/method. I've tried the following for lack of good
ideas:
try {
... some python call ...
return 0;
} catch (error_already_set&) {
assert(PyErr_Occurred());
PyErr_Print();
return -1;
}
Sure enough I'm getting -1 back, but nothing is printed to stderr AFAIK. Or
is this one of those cases where Python doesn't actually care about
sys.stderr and use C's notion of stderr instead?
What's a good way to find out what error occurred (exhaustively matching
doesn't strike me as good).
j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070111/cdc8fe4e/attachment.htm>
More information about the Cplusplus-sig
mailing list