PDA

View Full Version : Piping output from python to xterm



Acglaphotis
August 27th, 2007, 12:58 AM
Hi

How would you pipe the output of wget from python to an xterm (or any terminal emulator)?

Thanks!

strider1551
August 27th, 2007, 02:31 AM
I think this will do it for you.



import subprocess
process = subprocess.Popen("command", shell=True, stdout=subprocess.PIPE, bufsize=0)
line = process.stdout.readline()
while line:
print line
line = process.stdout.readline()

Acglaphotis
August 27th, 2007, 03:11 AM
Thanks!