I am using a software called Mitsuba. It comes along with a Python implementation, wrapped with Boost. This line in Python:
scene = SceneHandler.loadScene(fileResolver.resolve("model.xml"), paramMap)
yields an error. The type of fileResolver.resolve is fs::path and the type of paramMap is ParameterMap according to the documentation.
The function signature in the C++ code is:
SceneHandler::loadScene(const fs::path &filename, const ParameterMap ¶ms)
The error is:
Traceback (most recent call last):
File "...\foo.py", line 22, in <module>
scene = SceneHandler.loadScene(fileResolver.resolve("model.xml"), paramMap)
ArgumentError: Python argument types in
SceneHandler.loadScene(str, StringMap)
did not match C++ signature:
loadScene(class boost::filesystem2::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem2::path_traits>, class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct mitsuba::SimpleStringOrdering,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >)
What further investigations can I make? Do you know where the problem comes from?
Unfortunately it’s not clear which of the arguments is causing a problem.
According to the error message you have, the return type of
fileResolver.resolveis apparentlystr, notboost::filesystem::basic_path. What you want to look at is where Mitsuba defines its Boost.Python interface to see if there is a “converter” registered for turning Python strings intoboost::fs::pathobjects. If not, you’ll have to figure out what the right way of getting a Python object that’s convertible to the correct type is for this library.For the second argument, you have basically the same checks to make, unless
StringMapis already a Boost.Python type (what doestype(paramMap.__class__)return?). It looks likeParameterMapis a typedef forBut again, there must be a Boost.Python converter registered that can do the conversion from the Python type.