extending python problem
rdejuana at my-deja.com
rdejuana at my-deja.com
Thu Jun 22 18:16:11 EDT 2000
I'm trying to extend python with c. I trying to
get the progam at the tutorial to work. but every
time i try to import it it tells me it cant find
the init function. This is the error:
>>>import libPYSTAF
Traceback (innermost last):
File "./libPYSTAF.py", line 3, in ?
import libPYSTAF.so
ImportError: dynamic module does not define init
function (initlibPYSTAF)
This is my code:
#include <Python.h>
void initlibPYSTAF();
static PyObject* libPYSTAF_system(PyObject
*self,PyObject * args)
{
char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return Py_BuildValue("i", sts);
}
static PyMethodDef libPYSTAFMethods[] =
{
{"system", libPYSTAF_system, METH_VARARGS},
{NULL, NULL} /* Sentinel */
};
void
initlibPYSTAF()
{
Py_InitModule("libPYSTAF", libPYSTAFMethods);
}
I'm new to coding, so i probably forgot something
stupid. If you stop it please tell what it is.
thanks
-rod
rdejuan at us.ibm.com
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list