I have a simple script to tail a log file for an error string, it works AOK but there is an unexpected side effect, when I run it in a shell.
if I echo "ERROR TEST" >> LOG in a separate shell, I get the following from the script ERROR TEST GOT YA :) ERROR TEST So it looks like I am getting stdout from the tail -f, and two copies of it ?, stdout should be piped to subprocess.stdout tail = subprocess.Popen(['tail', '-f', LOG_FILE], shell=False, stdout=subprocess.PIPE) for out in iter(tail.stdout.readline, ''): out_str = out.rstrip('\n') if out_str.find('ERROR') != -1: print 'GOT YA :)' time.sleep(1) Any ideas anyone ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor