when embedding Python, how do you redirect stdout/stderr?

David Gravereaux davygrvy at pobox.com
Thu Jun 14 16:54:17 EDT 2001


Dave Kuhlman <dkuhlman at rexx.com> wrote:

>However, if you want to do some of it in Python and initiate it
>from C, then create a Python class with a "write" method and use
>PyRun_SimpleString to assign an instance of that class to
>sys.stdout.

PySys_SetObject("stdout", myObj); , probably...

>You can read about it at:
>
>    http://www.python.org/doc/current/lib/module-sys.html

That gets me going, thanks.  I'm starting to better picture an abstraction layer
into my application.
--
David Gravereaux <davygrvy at pobox.com>
-=[ Ray's Famous and Truly the Original Pizza, NYC ]=-



More information about the Python-list mailing list