eryksun added the comment:
unbuffer works for me. It fakes a tty, so apt-get doesn't automatically enter
quiet mode.
import io
import subprocess
args = ['unbuffer', 'apt-get', 'download', 'firefox']
p = subprocess.Popen(args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out = io.TextIOWrapper(p.stdout, newline='')
while True:
c = out.read(1)
if c == '':
break
print(c, end='', flush=True)
p.wait()
unbuffer isn't required if you disable quiet mode as follows:
args = ['apt-get', '-q=0', 'download', 'firefox']
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com