I'm running into trouble trying to call a Python function from my C++ code.
I'm trying to call the Django function call_command, with the following parameters:
call_command('test', stdout=content)
See here why. This runs the command without the stdout=content argument:
PyObject_CallFunctionObjArgs(executeFunc, PyString_FromString("test"), NULL)
I can't, for the life of me, figure out how to create this keyword.
PyDict_New();
PyDict_SetItemString(...);
Nets me a 'stdout'='content' string, instead of stdout=content.
Py_BuildValue("{s=s}", ... , ...)
Does the same thing.
I can get the content PyObject no problem if necessary, I just can't seem to correctly create the stdout keyword argument without Python putting quotes (handling it as a string) at some point.
How can I call call_command('test', stdout=content) from the C API?