HIi everyone.
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??
This is the method i tried...
for eg:This is the python function i wants to call.
>>>def add(x):
... return x+10
This is my code in C:
PyObject *result = NULL;
int arg;
PyObject *arglist;
arg = 123;
my_callback = "add";
arglist = Py_BuildValue("(i)", arg);
result = PyObject_CallObject(my_callback, arglist);
Py_DECREF(arglist);
return result;
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??
Regards
Venkat
--
http://mail.python.org/mailman/listinfo/python-list