I have a C++ function that takes one std::string as an argument and a python object that is a buffer. I thought that I could pass the buffer directly and that Boost Python would convert it to a string automatically, but it does not:
Boost.Python.ArgumentError: Python argument types in
mod.decrypt(buffer)
did not match C++ signature:
decrypt(std::string string_to_decrypt)
Is it necessary to write converters for this? I thought it would implicitly convert. Thanks for any advice.
The error message says it all - your signature is a string, but you're passing it a buffer.
It's not going to introspect the object to determine how to convert it - buffer could be anything.
You need to convert it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.