Re: bufsize in subprocess

2012-01-22 Thread yves
import subprocess com = ['/bin/ls', '-l', '/usr/bin'] with subprocess.Popen(com, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as proc: for line in proc.stdout: print('out: ' + str(line, 'utf8')) -- Yves. http://www.SollerS.ca/

Re: bufsize in subprocess

2012-01-22 Thread yves
On 2012-01-22 00:27, Chris Rebert wrote: On Sat, Jan 21, 2012 at 9:45 PM, wrote: Is this the expected behavior? Yes. `.read()` [with no argument] on a file-like object reads until EOF. See http://docs.python.org/library/stdtypes.html#file.read Right, got it now. You want proc.stdout.readl

Re: bufsize in subprocess

2012-01-21 Thread Chris Rebert
On Sat, Jan 21, 2012 at 9:45 PM, wrote: > Is this the expected behavior? Yes. `.read()` [with no argument] on a file-like object reads until EOF. See http://docs.python.org/library/stdtypes.html#file.read > When I run this script, it reads only once, but I expected once per line > with bufsize=

bufsize in subprocess

2012-01-21 Thread yves
Is this the expected behaviour? When I run this script, it reads only once, but I expected once per line with bufsize=1. What I am trying to do is display the output of a slow process in a tkinter window as it runs. Right now, the process runs to completion, then display the result. imp