[C++-sig] Re: Calling a python function from C++ (from Jeff Holle)
Jeffrey Holle
jeff.holle at verizon.net
Wed Jun 30 04:30:46 CEST 2004
I've explored whats actually going on some with my debugger and now see
what is being thrown.
It is "error_already_set". This is a trivial object (it has no
attributes at all), and isn't much better than "catch (...)".
However, its name implies something. Is there a meaningful error
message set somewhere else that can be accessed within the catch clause
of "error_already_set"?
Jeff Holle wrote:
>>
>>
>>> An underlining concern I have is error handling. When
>>> PyImport_ImportModule fails, a NULL pointer is returned.
>>> Seems like the underlining machinery in "handle<>" is intolerant of
>>> this.
>>
>>
>>
>>
>> What makes you say that?
>>
> You are correct about the success in compiling your much cleaner
> example, and it works :-) , but has a flaw.
>
> When I hide the needed python script, the call to PyImport_ImportModule
> returns NULL.
> When this occurres, both your example and what I had created, but
> commented out throws something because I can catch it with
> "catch(...)". I don't however know how to be more specific. Any
> hints? Whatever it is, it doesn't inherit from "exception".
>
> If I was operating on windows, I would anticipate it was a "structured
> exception", or whatever Microsoft calls their propritary stuff. Don't
> know of the equivalent on linux though. Without the "catch (...)", the
> command line program exits with "Aborted".
More information about the Cplusplus-sig
mailing list