yet another: TypeError: No to_python (by-value) converter found for C++ type:
Hey guys! I know this has been answered to some extent before, but I just can't get to grips with it, so i know i'm doing something wrong... I export the following: //---------------------------------------------------------------- class_ <cNodeDescriptor, boost::noncopyable> ("cNodeDescriptor", no_init) .def ("getClassId",&cNodeDescriptor::getClassId) .def ("getName",&cNodeDescriptor::getName, return_value_policy <copy_const_reference> ()) ; //---------------------------------------------------------------- class_ <std::vector <cNodeDescriptor *> > ("cNodeDescriptorList") .def ("__iter__", iterator <std::vector <cNodeDescriptor *> > ()) ; And then, in python, i grab a cNodeDescriptorList, and when i try to iterate through it, it spits out: TypeError: No to_python (by-value) converter found for C++ type: class kikura::cNodeDescriptor * So... what am i doing wrong? If more info is needed, i'd be glad to supply it... Cheers!! // talsit.org
"tALSit de CoD" <talsit@talsit.org> writes:
Hey guys! I know this has been answered to some extent before, but I just can't get to grips with it, so i know i'm doing something wrong...
I export the following:
//---------------------------------------------------------------- class_ <cNodeDescriptor, boost::noncopyable> ("cNodeDescriptor", no_init) .def ("getClassId",&cNodeDescriptor::getClassId) .def ("getName",&cNodeDescriptor::getName, return_value_policy <copy_const_reference> ()) ;
//---------------------------------------------------------------- class_ <std::vector <cNodeDescriptor *> > ("cNodeDescriptorList") .def ("__iter__", iterator <std::vector <cNodeDescriptor *> > ()) ;
And then, in python, i grab a cNodeDescriptorList, and when i try to iterate through it, it spits out:
TypeError: No to_python (by-value) converter found for C++ type: class kikura::cNodeDescriptor *
So... what am i doing wrong?
If more info is needed, i'd be glad to supply it...
Try using range (http://www.boost.org/libs/python/doc/v2/iterator.html#range-spec) with a functions that return boost::indirect_iterator<std::vector<cNodeDescriptor*>::iterator> wrapped around the vector's begin() and end(). (http://www.boost.org/libs/iterator/doc/indirect_iterator.html) HTH, -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (2)
-
David Abrahams -
tALSit de CoD