PyDev 1.3.19/20, Linux

I have a simple Python code that refers to a module that is
implemented in C and is built into a pyextension.so library that is
located at the root of PYTHONPATH in this case. It executes OK but
PyDev chokes on this code and produces parsing error 'Undefined
variable from import: system    Sample.py       pytest/src/foo  line 4  PyDev
Problem'. Am I doing something wrong?

Is it known bug or should I file it? Can I help to fix it? Code is below

-Radim

------------python code  ---------------------
#!/usr/bin/python2.4
import pyextension

def Main():
  pyextension.system("ls -l")


if __name__ == '__main__':
    Main()

------------native code  ---------------------
#include <Python.h>

static PyObject *pyextension_system(PyObject *self, PyObject *args);

static PyMethodDef SpamMethods[] = {
    {"system",  pyextension_system, METH_VARARGS, "Execute a shell command."},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};

PyMODINIT_FUNC
initpyextension(void)
{
    (void) Py_InitModule("pyextension", SpamMethods);
}

static PyObject *
pyextension_system(PyObject *self, PyObject *args)
{
    const char *command;
    int sts;

    if (!PyArg_ParseTuple(args, "s", &command))
        return NULL;
    sts = system(command);
    return Py_BuildValue("i", sts);
}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pydev-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-users

Reply via email to