[python-win32] Re: How do I re-assign stdin and stdout
Roger Upole
rwupole at msn.com
Sat Jul 24 05:13:59 CEST 2004
You'll need to set win32con.STARTF_USESTDHANDLES in the dwFlags member of PySTARTUPINFO.
Also, the PySECURITY_ATTRIBUTES in the call to CreateFile has to have bInherit set to True,
and the bInheritHandles parm to CreateProcess has to be True.
hth
Roger
>>> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20040723/8f678e47/attachment.html
More information about the Python-win32
mailing list