HIi everyone.<br>i was using python/c api to call a python function from c and I know the name of the function which i want to call.Is there any way to do that??<br>This is the method i tried...<br><br>for eg:This is the python function i wants to call.<br>
>>>def add(x):<br>... return x+10<br><br><br>This is my code in C:<br> PyObject *result = NULL;<br> int arg;<br> PyObject *arglist;<br> arg = 123;<br> my_callback = "add";<br> arglist = Py_BuildValue("(i)", arg);<br>
result = PyObject_CallObject(my_callback, arglist);<br> Py_DECREF(arglist);<br> return result;<br> <br>I was getting a error like "str object is not callable".From the error i came to know that i was assigning "add" as a string which caused this error.Then how to make it a callable object??<br>
<br>Regards<br>Venkat<br><br>