Hi, I have a script that I want to execute from C. I don't want to call any
functions, just execute the script. Below is a code snippet.
The problem is that PyObject_CallOb ject always returns NULL. Is this the
correct return value for simply executing a script, as there is no function
return value involved?
// load script
pname = PyString_FromSt ring(SCRIPTFILE NAME);
pmodule = PyImport_Import (pname);
Py_DECREF(pname );
if (pmodule != NULL)
{
// execute script
presult = PyObject_CallOb ject(pmodule, NULL);
if (presult == NULL)
{
Py_DECREF(pmodu le);
return;
}
Py_DECREF(presu lt);
Py_DECREF(pmodu le);
}
else
{
return;
}
regards, Andy
andy@britishide as1965.com (remove year to reply)
functions, just execute the script. Below is a code snippet.
The problem is that PyObject_CallOb ject always returns NULL. Is this the
correct return value for simply executing a script, as there is no function
return value involved?
// load script
pname = PyString_FromSt ring(SCRIPTFILE NAME);
pmodule = PyImport_Import (pname);
Py_DECREF(pname );
if (pmodule != NULL)
{
// execute script
presult = PyObject_CallOb ject(pmodule, NULL);
if (presult == NULL)
{
Py_DECREF(pmodu le);
return;
}
Py_DECREF(presu lt);
Py_DECREF(pmodu le);
}
else
{
return;
}
regards, Andy
andy@britishide as1965.com (remove year to reply)
Comment