Piping output to a web browser...
Skip Hollowell
thollowe at opentext.com
Wed Jun 14 15:34:26 EDT 2000
A while back I saw a thread about keeping a web coonection alive (too bad I
saw it 4 hours AFTER I came up with the same general plan). But I am still
struggling with how I can pipe the output to the screen on a streaming
basis. The code I have seems to cache it all up and pushes it to the screen
all at once once I return out of the function. Any ideas?
print "Content-type: text/html"
print
sys.stdout.flush()
print "<TITLE> Hello, World!</TITLE>"
sys.stdout.flush()
print "<PRE>Hello, World!"
sys.stdout.flush()
os.system ('date > /tmp/z.z')
# This following routine takes a while to run but will delete the
/tmp/z.z file when it is done.
os.system ('PATH=' + mypath + ';' + support.ottestindexsitefile +
fFlags + ' >/tmp/x.x 2>&1 & ')
sys.stdout.flush()
while 1:
try:
#s = os.stat ('/tmp/z.z')
f = open ('/tmp/z.z')
except IOError:
print "Process Done."
break
print ('Processing...')
f.close()
os.system ('sleep 2;date')
sys.stdout.flush()
os.system ('rm /tmp/z.z')
return 'ZZZ'
More information about the Python-list
mailing list