reading stdout from a running win32 process

Jules Stevenson lists at js3d.co.uk
Tue Jan 6 12:51:03 EST 2009


Hi list,

I'm launching a process from windows using the demo 'winprocess' from the
win32 extensions. I want to be able to record the output of the process as
it runs and display it elsewhere. If I use the following [very bad] code:

import winprocess
import tempfile
import time

some_condition=True
out=tempfile.TemporaryFile()

#launch process
winprocess.run('xsibatch.exe', show=1, stdout=out, stderr=out)

while some_condition<20:
    print out.read()
    time.sleep(0.2)
    some_condition+=1

out.close()

I don't seem to be able to read the 'out' at all? If I omit redirecting
stdout etc then the output displays fine in the console.

Any info / pointers on where I'm going very wrong much appreciated.

Jules




More information about the Python-list mailing list