Problem with C-API

John Dean john at
Fri Mar 17 21:17:16 CET 2006

Hi Duncan

Your version of the app works apart from this part


else {
         PyObject *rString = PyObject_Str(result);
         if (rString==NULL) {

         printf( "The result is %s\n", PyString_AsString(rString));

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

More information about the Python-list mailing list