|
Boost : |
From: Karl Bellve (Karl.Bellve_at_[hidden])
Date: 2001-04-03 09:06:14
I am trying to capture STDIO/STDERR of python that has been linked into
my application.
static struct _object *s_stdout(PyObject *self, PyObject *args)
{
char *string;
if (!PyArg_ParseTuple(args, "s", &string))
return Py_None;
// do something with the string
return Py_None;
}
Inside Python (PyRun_SimpleString()), I redirect sys.stdout to the above
function. The function is being called but PyArg_ParseTuple() is failing
to find a "s" tuple. Poking inside "args", I do find pointer called
"tp_name" pointing to a string containing "string". This is under NT,
and MSVC.
BTW, BPL doesn't like me returning NULL but I understand that is fixed
in the current source in the CVS tree.
-- Cheers, Karl Bellve
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk