bufsize in subprocess
yves at zioup.com
yves at zioup.com
Sun Jan 22 00:45:51 EST 2012
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.
import subprocess
com = ['/bin/ls', '-l', '/usr/bin']
with subprocess.Popen(com, bufsize=1, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) as proc:
print('out: ' + str(proc.stdout.read(), 'utf8'))
Thanks.
--
Yves. http://www.SollerS.ca/
http://ipv6.SollerS.ca
http://blog.zioup.org/
More information about the Python-list
mailing list