I am using the subprocess module in 2.4.  Here's the fragment:

bufcaller.py:
        import sys, subprocess
        proc = subprocess.Popen('python bufcallee.py', bufsize=0,
shell=True, stdout=subprocess.PIPE)
        for line in proc.stdout:
                sys.stdout.write(line)

bufcallee.py:
        import time
        print 'START'
        time.sleep(10)
        print 'STOP'

Although the documentation says that the output should be unbuffered
(bufsize=0) the program (bufcaller) pauses for 10 seconds and then
prints START immediately followed by 'STOP' rather than pausing 10
seconds in between them.  Note that I made bufcallee a Python script for
ease of the example but in the real-world problem I am trying to solve
it is simply an executable.

Any ideas?
Jeff
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to