Why does bufsize=1 not work in subprocess.Popen ?



I read in the docs that "bufsize=1" causes line buffering. (for subprocess.Popen)

The following tiny program launches an executable file and then receives its output. That works, but I want to
receive each line as it is ouput, not all of the lines at termination, which is what is happening.
-------------------------------------------------------
from subprocess import Popen, PIPE
from os import remove, sep

p = Popen("." + sep + "myprogram", stdout=PIPE, bufsize=1)

while(1):
line = p.stdout.readline() # get next line
print line,
if line.count("terminator"):
break
------------------------------------------------------
How can I get line buffering?

Mitchell Timin

--
I'm proud of http://ANNEvolve.sourceforge.net. If you want to write software,
or articles, or do testing or research for ANNEvolve, let me know.

Humans may know that my email address is: (but remove the 3 digit number)
zenguy at shaw666 dot ca


.



Relevant Pages

  • Re: I think I know why setstyle double buffering cases invalidOperationExceptions!
    ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... > Answer those GDI+ questions with the GDI+ FAQ ... >> option, where I chose auto-double buffering or manual buffering, and the ... >> The fact that GDI+ take away my ability to control when the backbuffer is ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Double Buffering now
    ... >From your description you've set up double buffering in the form. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Double buffering with pagescale
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > Without double buffering, increasing the pagescale magnifies ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Double Buffering now
    ... Control and setting the double buffering in it's constructor. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Double buffering with pagescale
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... > Another nail in the coffin for double buffering. ... >>> Without double buffering, increasing the pagescale magnifies ...
    (microsoft.public.dotnet.framework.drawing)