Watch log

Michele Simionato michele.simionato at
Tue Jan 16 06:21:06 CET 2007

Salvatore Di Fazio wrote:
> Hi guys,
> I've an application that writes a log file.
> I need to write an application with python that will read this file.

You may begin from this:

$ cat
import sys
from ScrolledText import ScrolledText

interval =50 # ms

def displayfile(f, textwidget):
    textwidget.insert('end', f.readline())
    textwidget.after(interval, displayfile, f, textwidget)

if __name__ == '__main__':
    st = ScrolledText()
    displayfile(sys.stdin, st)

$ python < mylogfile.log

             Michele Simionato

More information about the Python-list mailing list