Skip to content

Commit

Permalink
Simple script that prints out data.pkl in a human-readable format. So…
Browse files Browse the repository at this point in the history
…on to be extended.
  • Loading branch information
dontpanic committed Mar 14, 2011
1 parent c27709e commit db151ea
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions smstat.py
@@ -0,0 +1,30 @@
#!/usr/bin/env python

# This is an incomplete implementation of smstat.py. It exists to test and detail
# the addition of meta-data pickling in sitemonitor.py.
# - dontpanic (matthew.maniaci@gmail.com)

import pickle, os, sys, pprint
#from optparse import OptionParser, OptionValueError

def load_old_results(file_path):
'''Attempts to load most recent results'''
pickledata = {}
if os.path.isfile(file_path):
picklefile = open(file_path, 'rb')
pickledata = pickle.load(picklefile)
picklefile.close()
return pickledata

def main():
print '(Incomplete) Site Monitor Stat\n'
pickledata = load_old_results('data.pkl')
printer = pprint.PrettyPrinter(indent=4)

# This is all we are gonna do for now, soon this script will
# take command-line options to determine what and how to print
print 'Un-pickled metadata:'
printer.pprint(pickledata);

if __name__ == '__main__':
main()

0 comments on commit db151ea

Please sign in to comment.