Re: [C++-sig] Boost::Python to_python converter

2012-04-03 Thread DarkAnt
Thanks a bunch Stefan! On Tue, Apr 3, 2012 at 12:01 PM, Stefan Seefeld wrote: > DarkAnt, > > the problem is that you don't initialize / import the newly defined > module. The attached version works fine for me. > >    Stefan > > -- > >      ...ich hab' noch einen Koffer in Berlin... > ___

Re: [C++-sig] Boost::Python to_python converter

2012-04-03 Thread Stefan Seefeld
DarkAnt, the problem is that you don't initialize / import the newly defined module. The attached version works fine for me. Stefan -- ...ich hab' noch einen Koffer in Berlin... #include #include struct Unit { int health; std::string name; std::string type; std::pair

Re: [C++-sig] Boost::Python to_python converter

2012-04-03 Thread DarkAnt
I removed everything except int health and I still crash. If I do not have the explicit to_python converter I receive this error message: TypeError: No to_python (by-value) converter found for C++ type: Unit On Tue, Apr 3, 2012 at 11:20 AM, Stefan Seefeld wrote: > DarkAnt, > > have you tried taki

Re: [C++-sig] Boost::Python to_python converter

2012-04-03 Thread Stefan Seefeld
DarkAnt, have you tried taking out the explicit to_python converter ? I don't think you need that, as the class_ will already implicitly provide that. Also, out of curiosity: I'm not sure the "coord" member conversion will work out-of-the-box, unless you also reflect std::pair to Python using clas

[C++-sig] Boost::Python to_python converter

2012-04-03 Thread DarkAnt
I'm having a conceptual issue with the way C++ interfaces with Python. I'm trying to convert a C++ object to a Python object, but my attempt causes the program to crash. I suspect I'm doing a lot of things wrong. Ultimately I'd like to be able to pass C++ objects to a python function that modifies