Initial File Upload

This commit is contained in:
Cort Buffington 2015-06-30 11:51:04 -05:00
parent 8e85b71e27
commit d7f11d955c
1 changed files with 34 additions and 0 deletions

34
pickle_stat_reader.py Normal file
View File

@ -0,0 +1,34 @@
from __future__ import print_function
from cPickle import load
from pprint import pprint
from os.path import getmtime
from time import sleep
# This is the only user-configuration necessary
# Tell the program where the pickle file is
stat_file = 'dmrlink_stats.pickle'
last = getmtime(stat_file)
def read_dict():
try:
with open(stat_file, 'rb') as file:
NETWORK = load(file)
return NETWORK
except IOError as detail:
print('I/O Error: {}'.format(detail))
except EOFError:
print('EOFError')
pprint(read_dict())
while 1:
sleep(1)
now = getmtime(stat_file)
if now > last:
last = now
pprint(read_dict())