On 2012-01-22 00:27, Chris Rebert wrote:
On Sat, Jan 21, 2012 at 9:45 PM,<y...@zioup.com> 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.readline().
Yes, or a for loop, this works for me now:
import subprocess
com = ['/bin/ls', '-l', '/usr/bin']
with subprocess.Popen(com, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) as proc:
for line in proc:
print('out: ' + str(line, 'utf8'))
--
Yves. http://www.SollerS.ca/
http://ipv6.SollerS.ca
http://blog.zioup.org/
--
http://mail.python.org/mailman/listinfo/python-list