Jan-03-2018, 03:41 AM
Hello Everyone,
As I'm new to python, i tried some script but while running that script getting an error i.e. "There's an error in your program: invalid syntax" for PyObject*. Any one faced same issue please reply back.
spammodul.c
#include <Python.h>
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
const char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return PyLong_FromLong(sts);
}
python script
import spam
status = spam.system("ls -l")
Thanks and Regards
Mamta Parida
As I'm new to python, i tried some script but while running that script getting an error i.e. "There's an error in your program: invalid syntax" for PyObject*. Any one faced same issue please reply back.
spammodul.c
#include <Python.h>
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
const char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return PyLong_FromLong(sts);
}
python script
import spam
status = spam.system("ls -l")
Thanks and Regards
Mamta Parida