I have a BASH script running that opens a program (tshark) which writes a bunch of values to a logfile. The script then counts the unique values and writes the (count of the) uniques values from the last 3 minutes to a logfile (count3m.log) It also opens a python script. The python is there to show a window with the values from count3m.log. As the value in count3m.log changes every 30 seconds I want to keep looking for a new value from count3m. I tried it with the code below. It only executes the loop once. What am I doing wrong?
#!/usr/bin/env python
import sys
import re
import time
from Tkinter import *
while True:
root = Tk()
count3m = open('count3m.log','r')
countStart = open('countStart.log','r')
minutes = Label(root, text="Uniq signals < 3m ago:")
minutes.grid(row=0, column=0)
minutes = Label(root, text=count3m.read())
minutes.grid(row=1, column=0)
count3m.close
minutes = Label(root, text="Uniq signals since start:")
minutes.grid(row=0, column=1)
minutes = Label(root, text=countStart.read())
minutes.grid(row=1, column=1)
countStart.close
time.sleep(5)
print "test"
root.mainloop()