2014-03-20 20:31:26 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
Simple script to dump the contents of msgpack files to the terminal
|
|
|
|
'''
|
2017-04-04 12:11:54 +00:00
|
|
|
# pylint: disable=resource-leakage
|
2014-03-20 20:31:26 +00:00
|
|
|
# Import python libs
|
2014-11-24 03:03:48 +00:00
|
|
|
from __future__ import absolute_import, print_function
|
2014-03-20 20:31:26 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import pprint
|
|
|
|
|
|
|
|
# Import third party libs
|
|
|
|
import msgpack
|
|
|
|
|
|
|
|
|
|
|
|
def dump(path):
|
|
|
|
'''
|
|
|
|
Read in a path and dump the contents to the screen
|
|
|
|
'''
|
|
|
|
if not os.path.isfile(path):
|
2014-11-24 03:03:48 +00:00
|
|
|
print('Not a file')
|
2014-03-20 20:31:26 +00:00
|
|
|
return
|
|
|
|
with open(path, 'rb') as fp_:
|
|
|
|
data = msgpack.loads(fp_.read())
|
|
|
|
pprint.pprint(data)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
dump(sys.argv[1])
|