I'm struggling with PyObject_CallMethod
trying to send unsigned char *
to python script, but it gives me error calling the method on the python side. I've tried s,s#,s*,y
and B
formats but with no luck. which format should I use?
Here's the reference I'm looking at https://docs.python.org/3/c-api/arg.html#c.Py_BuildValue
I found the solution!
I had to memcpy
the unsigned char *
with known size to unsigned char[KNOWN_SIZE]
and then send it based on this link: https://docs.python.org/3/c-api/arg.html , I had to send the array with this flag 's#'
where s
refers to the type of the type of the first parameter and #
is the size of the first parameter.