#! /usr/bin/env python from socket import * import string import time import sys def drive(fn): infile = open(fn, "r"); lines = infile.readlines(); for line in lines: if line[0]<>'#': tokens = string.split(line) if len(tokens) == 0: break rest = string.join(tokens[1:]) sleeptime = int(tokens[0])/1000.0 time.sleep(sleeptime); print rest sys.stdout.flush() while 1: time.sleep(10) if __name__ == "__main__": if len(sys.argv) > 1: drive(sys.argv[1]); else: print "usage:\n SignalDriver filename"