PyRun_String

Mike Morasky mikem at wetafx.co.nz
Fri May 19 04:11:32 EDT 2000


Embedded in a simple c++ program, I've defined a global dictionary and then:

        PyObject *resultObj = PyRun_String(script, Py_file_input, globalDict,
globalDict);
        if( !resultObj )
         {
                PyErr_Print();
           }
            else
            {
                PyObject_Print(resultObj, stdout, 1);
                Py_DECREF(resultObj);
            }

Anyway, it appears to execute just fine and the errors all print exactly what
you'd expect but the non-error rusults always print "None". I suspect the int
arg to PyObject_Print is wrong. I found reference to Py_Print_RAW, which I
tried but is undefined as a constant.

Anyone have any pointers?






More information about the Python-list mailing list