Chris Angelico <ros...@gmail.com> writes: > On Wed, Aug 27, 2014 at 4:37 PM, Steven D'Aprano <st...@pearwood.info> wrote: >> On Wed, 27 Aug 2014 08:29:20 +0300, Marko Rauhamaa wrote: >> >>> Try flushing after each print. >> >> Doesn't help. > > It does, but insufficiently. If slurp.py is run under Py3, it works > fine; or take Naoki's suggestion (although without the parens): > > import sys > import time > > for line in iter(sys.stdin.readline, ''): > print "Time of input:", time.ctime(), line > sys.stdin.flush() > sys.stdout.flush() > > Then it works. > > ChrisA
It looks like this bug http://bugs.python.org/issue3907 `python -u out.py | python -u slurp.py` could be used to avoid .flush() calls everywhere. Or reassign `sys.stdin = io.open(sys.stdin.fileno(), 'r', 1)` inside the script. http://stackoverflow.com/questions/107705/python-output-buffering -- Akira -- https://mail.python.org/mailman/listinfo/python-list