ich versuche, an eine Ausgabe eines Programms zu kommen, welches Stdout regelmäßig flushed. Irgendwie komm ich nicht an die Daten.
output.py
Code: Alles auswählen
import sys
import time
for x in range(200):
sys.stdout.write("\r"+str(x))
time.sleep(0.125)
sys.stdout.flush()
Code: Alles auswählen
import subprocess
command_string = "C:\Python26\python.exe output.py"
process = subprocess.Popen(command_string, stdout=subprocess.PIPE)
while True:
buff = process.stdout.readline()
print process, buff
if buff == '' and process.poll() != None:
print "breaking"
break
process.wait()
print "finished"
Grüße,
anogayales