[C++-sig] How to capture stdout/stderr?

Peter python at cityofdreams.com
Sat Aug 28 07:08:31 CEST 2004


Hi,

I am trying to capture stdout and stderr from Python using boost.python.
 I can do it using the Python C API but can't work out the correct way
to do it using the boost wrappers.  Using the  C API I'd do something like:

PyObject* pObj = Py_InitModule("stdout", my_methods);
PySys_SetObject("stdout", pObj);
PySys_SetObject("stderr", pObj);

How should I do this with boost?

Thanks
Peter




More information about the Cplusplus-sig mailing list