Boost logo

Boost Users :

From: ctrembla_at_[hidden]
Date: 2006-09-08 16:18:53


Hi,

newbie in python and boost::python

I have a method in c++ that returns a vector of strings, how can i
expose this method in python, and how should i use it in python

class A
{

public:
        
        std::vector<std::string> getName();
};

BOOST_PYTHON_MODULE(pysession)
{
        class_<A>("A")
        .def("GetName" ,&A::getName)
}

now in python how could i call the function getName() ?

here is my error in python

TypeError: No to_python (by-value) converter found for C++ type: class
std::vect
or<class std::basic_string<char,struct std::char_traits<char>,class
std::allocat
or<char> >,class std::allocator<class std::basic_string<char,struct
std::char_tr
aits<char>,class std::allocator<char> > > >
not valid

thanks, Charles.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net