J
John Dean
Hi
I spent the whole of yesterday trying the get the following C code to
execute
PyRun_String("def title();", Py_file_input, dict, dict);
PyRun_String("\treturn 'Foo Bar'", Py_file_input, dict, dict);
PyRun_String("x = title()", Py_file_input, dict, dict);
PyObject * result = PyRun_String("print x", Py_file_input, dict, dict);
printf( "The result is %s\n", PyObject_AsString( result );
Each line throws an error.
Could somebody tell what is wrong with the above code.
Here below is the output from my test app
Starting Test ......
The file "testtitle" is open for reading
The variable codeStrings contains
Line 0 def title()
Line 1 return "Foo Bar"
The variable scriptText contains
def title()
return "Foo Bar"
The variable tempList contains
Line 0 testtitle
Line 1 title
Module Name is testtitle
Function Name is title
The variable functionCode contains
def title()
return "Foo Bar"
Python initialized successfully
Module object successfully created
Dict object successfully created
Failed to create a Result object.
The title of the this task is <nil>
I spent the whole of yesterday trying the get the following C code to
execute
PyRun_String("def title();", Py_file_input, dict, dict);
PyRun_String("\treturn 'Foo Bar'", Py_file_input, dict, dict);
PyRun_String("x = title()", Py_file_input, dict, dict);
PyObject * result = PyRun_String("print x", Py_file_input, dict, dict);
printf( "The result is %s\n", PyObject_AsString( result );
Each line throws an error.
Could somebody tell what is wrong with the above code.
Here below is the output from my test app
Starting Test ......
The file "testtitle" is open for reading
The variable codeStrings contains
Line 0 def title()
Line 1 return "Foo Bar"
The variable scriptText contains
def title()
return "Foo Bar"
The variable tempList contains
Line 0 testtitle
Line 1 title
Module Name is testtitle
Function Name is title
The variable functionCode contains
def title()
return "Foo Bar"
Python initialized successfully
Module object successfully created
Dict object successfully created
Failed to create a Result object.
The title of the this task is <nil>