Changing interpreter's deafult output/error streams
Robert Kern
rkern at ucsd.edu
Mon Aug 1 08:15:54 EDT 2005
Ira wrote:
> OK let me rephrase,
>
> the standard error stream (and if I'm not mistaken also the one that
> PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
> ahead and write the following in python...
>
> SomeNewStreamOrFileOrWhateverItIs = new stream
> sys.stderr = SomeNewStreamOrFileOrWhateverItIs
>
> I can go ahead and do the exact same thing from the C source code. All I
> need to do is to figure out how to wrap a c-style FILE* with a PyObject, And
> PySys_SetObjet("stderr", newstream);
>
> I'm very new to python so that might be nonsense but it appeals to my
> programmer's common sense. Can anyone tell me how to do this?
http://docs.python.org/api/fileObjects.html
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list