Embedding - getting full error string

Paul Miller paul at fxtech.com
Sun Feb 8 10:51:27 EST 2004


>static PyObject *mymodule_printit(PyObject *self, PyObject* args)
>{
>         char *s;
>         PyArg_ParseTuple(args, "s", &s);
>         PrintToWindow(s); <-- my function
>         return NULL;
>}

One problem is technically you're returning an error from your print 
function. You need to return an increfed PyNone:

         Py_INCREF(Py_None);
         return Py_None;

Otherwise your code looks pretty much like mine does, and it works fine.







More information about the Python-list mailing list