Compared to your program, I * Made sure that the slave program actually flushed its stdout buffers * didn't call read(), which will by default continue reading until it reaches EOF, not merely read the available data
#!/usr/bin/env python import sys, time, Tkinter, itertools, _tkinter, os if '-slave' in sys.argv: for i in itertools.count(): time.sleep(1) print "This is a line of output:", i sys.stdout.flush() raise SystemExit root = Tkinter.Tk() root.wm_withdraw() fh = os.popen('%s -slave' % sys.argv[0]) def reader(*args): line = fh.readline() if not line: print "EOF from slave" raise SystemExit print "from slave: %r" % line _tkinter.createfilehandler(fh, Tkinter.READABLE, reader) root.mainloop()
pgpGq56Vnc7dS.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list