boost.python: Argument types did not match C++ signature

Viewed 21094

I am having a strange problem when calling a C++ function in python.

I exposed a class from which I want to call a function:

class_<MyClass, std::shared_ptr<MyClass>>("MyClass", init<>())
    // ...
    .def("someFunc", &MyClass::someFunc)
;

I get a std::shared_ptr<MyClass> from a member variable from another class which is exposed via .def_readonly(...)

When I try to call the function, I get the following error:

File "pytest.py", line 27, in test_func
    cu.someFunc("string")
Boost.Python.ArgumentError: Python argument types in
    MyClass.someFunc(MyClass, str)
did not match C++ signature:
    result(MyClass{lvalue}, std::string)

As far as I see, the signatures do match. Does someone see the problem?

2 Answers
Related