[C++-sig] Python exceptions in functions called from C++
charlessolar at gmail.com
Wed Jun 9 22:18:09 CEST 2010
Thanks for the quick replies. Ill try this fetch stuff, maybe i can find
some way to hack it into boost python so I do not have to modify every
override call I make in my project.
>> If you call Python from C++, why are you saying you are not embedding
Python ? What do you mean by that ?
My app is a library that is imported into python. But my library can call
into python for certain things. My definition of embedded python would be
an executable that can be extended with python so if that is wrong then I
On Wed, Jun 9, 2010 at 2:41 PM, Stefan Seefeld <seefeld at sympatico.ca> wrote:
> On 06/09/2010 03:11 PM, Charles Solar wrote:
>> I have a boost python library that I build python scripts with. I am not
>> embedding python, I think that is worth mentioning right off the bat.
>> In my C++ library I have a separate thread calling into python
> If you call Python from C++, why are you saying you are not embedding
> Python ? What do you mean by that ?
> and I am finding that if the function I call in python has a python error
>> in it, eg:
>> def callMe():
>> crash = "Hello world"
>> return crash()
>> When my C++ app calls that I get the error_already_set exception from
>> boost python. My problem with that is it offers no information from python
>> like 'Strings are not callable on line 200 in crash.py' So my question is
>> how can I connect the error_already_set exception on the other thread to
>> python's exception handler so if python produces an exception while calling
>> from C++ I get the python exception information and not just 'error already
> Right now you need to use the Python C API to fetch those details (see
> I keep meaning to write C++ wrappers around that API, but it always falls
> off of my (fixed-size) TODO list. Perhaps someone else will beat me to it ?
> ...ich hab' noch einen Koffer in Berlin...
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cplusplus-sig