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.resolve
is apparently str
, not boost::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 into boost::fs::path
objects. 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 StringMap
is already a Boost.Python type (what does type(paramMap.__class__)
return?). It looks like ParameterMap
is a typedef for
`std::map<std::string, std::string, mitsuba::SimpleStringOrdering>`
But again, there must be a Boost.Python converter registered that can do the conversion from the Python type.