I am working with an existing module at the moment that provides a C ++ interface and performs several string operations.
I needed to use Unicode strings, and, unfortunately, the module did not have Unicode interface support, so I wrote an additional function to add to the interface:
void SomeUnicodeFunction(const wchar_t* string)
However, when I try to use the following code in Python:
SomeModule.SomeUnicodeFunction(ctypes.c_wchar_p(unicode_string))
I get this error:
ArgumentError: Python argument types in SomeModule.SomeUnicodeFunction(SomeModule, c_wchar_p) did not match C++ signature: SomeUnicodeFunction(... {lvalue}, wchar_t const*)
(names changed).
I tried changing wchar_t in a C ++ module to Py_UNICODE without success. How to solve this problem?
c ++ python module unicode
Matthew iselin
source share