[python-win32] How do I re-assign stdin and stdout

Mark Hammond mhammond at skippinet.com.au
Sat Jul 24 01:14:51 CEST 2004


The simplest way is to use the popen() family of functions.  If you really
do need to re-implement it in Python, you probably want to check out the
source to popen - it plays a similar dance you what you tried.

Mark.

> -----Original Message-----
> From: python-win32-bounces at python.org
> [mailto:python-win32-bounces at python.org]On Behalf Of Greg Baryza
> Sent: Saturday, 24 July 2004 2:54 AM
> To: python-win32 at python.org
> Subject: [python-win32] How do I re-assign stdin and stdout
>
>
> Sorry for the newbie question, but...
>
> So far I have been creating scripts that automate command
> invocations and
> start up Windows apps just fine.  Now, however, I wanted
> automate some
> Perforce commands.  Perforce has an option that takes writes
> its command
> output as a marshaled Python dictionary.  This requires me to
> route stdout
> to a file.
>
> I have created a file using win32file and gotten back a file
> handle.  I
> have assigned that file handle to the hStdOutput item in
> STARTUPINFO.  I
> have passed the STARTUPINFO to the win32process.CreateProcess
> method.  Yet,
> the output does not get written to the file.
>
> I have tested various combinations of create and sharing options, but
> nothing seems to work.  There is obviously some detail I am
> missing.  Can
> someone give me the nudge I need to get over this hurdle?
>
> TIA
>
> <G>
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the Python-win32 mailing list