Redirecting Python stdout ,stderr and stdin

Alexander Schmolck a.schmolck at gmx.net
Sun Nov 23 19:21:47 EST 2003


Jan Knop <nospam at nospam.yes> writes:

> Hello
> 
> I am writing a  Windows application where I need to  redirect stdin,
> stdout and  stderr from Python.  to my application
> Is it a simple way  of  do it  ?

import sys
sys.stdin, sys.stderr, sys.stdout = map(open, 'in.txt err.txt out.txt'.split(),
                                              'r w w'.split())
'as




More information about the Python-list mailing list