Problem with C-API
John Dean
john at totalrekall.co.uk
Fri Mar 17 15:17:16 EST 2006
Hi Duncan
Your version of the app works apart from this part
....
....
else {
PyObject *rString = PyObject_Str(result);
if (rString==NULL) {
Py_DECREF(result);
PyErr_Print();
return;
}
printf( "The result is %s\n", PyString_AsString(rString));
Py_DECREF(rString);
Py_DECREF(result);
}
}
The result of the printf state is: "The result is None"
result = PyRun_String("print x", Py_file_input, dict, dict);
The above line of code displays the value returned from the title()
function. My problem is I need to be able to cature the return value because
in the real application it will be displayed in a Process Log Widget. Also
the real scripts will be much longer.
I have not had a problem writing Python extensions, but when it comes to
embedded Python I just see how to get my code to work.
Any further help would be greatly appreciated
--
Best Regards
John
More information about the Python-list
mailing list