#!/usr/bin/env python3

"""
Reads a pickled (python) object from a file
Accepts the file as the first argument
"""

import os
import sys
import pickle
import pprint

if len(sys.argv) < 2:
    print(
        "Error: Must provide a file to read a pickle from as the first argument.",
        file=sys.stderr,
    )
    sys.exit(1)

filepath = os.path.abspath(sys.argv[1])
with open(filepath, "rb") as picklef:
    data = pickle.load(picklef)

pprint.pprint(data)
