-1

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

Alaa Agwa
  • 162
  • 1
  • 12
  • Can you post the code snippet that performs the call to `PyObject_CallMethod`? – lubgr Apr 01 '19 at 17:59
  • Post a [mcve] reproducing your specific problem as required here please, include all error messages verbatim, and don't forget to narrow the code to the least necessary to reproduce exactly the problem. Thank you for flying with _Stack Overflow Airways_ and obey all our security instructions seriously. – πάντα ῥεῖ Apr 01 '19 at 18:02

1 Answers1

0

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.

Alaa Agwa
  • 162
  • 1
  • 12