#!/usr/bin/env python import datetime import re import sys import time import matplotlib matplotlib.use('GTKAgg') from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as \ FigureCanvas from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as \ NavigationToolbar from matplotlib.axes import Subplot from matplotlib.figure import Figure import gtk # Make sure we're been given a filename as a command line argument. if len(sys.argv) < 2: print 'Usage: temp_plotter.py ' sys.exit(2) # Now attempt to open the file. filename = sys.argv[1] try: log_file = file(filename, 'r') except IOError: print 'Error: Failed to open file %s' % filename sys.exit(1) # Grab the data and release the file. lines = log_file.readlines() log_file.close() # Now parse the data. # Need these in order to parse the date/times. pattern = re.compile(r'(?P