Hi, I m trying a read the output of a process which is running continuously with subprocess.Popen. However the readline() method hangs for the process to finish. Please let me know if the following code can be made to work with subprocess.Popen with threads or queues. I tried a lot of methods but to no avail. It would be great if someone can make it work.
import subprocess p1 = subprocess.Popen('tail -f /var/log/ messages',stdout=subprocess.PIPE,shell=True) p2 = subprocess.Popen('grep something',stdin=p1.stdout,stdout=subprocess.PIPE,shell=True) while 1: line = p2.stdout.readline() print line Thanks, ~Ashok. -- http://mail.python.org/mailman/listinfo/python-list