Watch log
Michele Simionato
michele.simionato at gmail.com
Tue Jan 16 00:21:06 EST 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 showlog.py
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()
st.pack()
displayfile(sys.stdin, st)
st.mainloop()
$ python showlog.py < mylogfile.log
HTH,
Michele Simionato
More information about the Python-list
mailing list