Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
eoa-utilities/showpickle.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
37 lines (26 sloc)
769 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8; mode: python -*- | |
""" | |
Pretty print contents of pickle file | |
""" | |
__version__ = "1.0" | |
__date__ = "20190730" | |
__author__ = "kthoden@mpiwg-berlin.mpg.de" | |
import argparse | |
import logging | |
import pickle5 as pickle | |
import pprint | |
logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s') | |
def main(): | |
"""The main bit""" | |
parser = argparse.ArgumentParser() | |
parser.add_argument("picklefile", help="The pickle file to be inspected") | |
args = parser.parse_args() | |
with open(args.picklefile, "rb") as piii: | |
data = pickle.load(piii) | |
pp = pprint.PrettyPrinter(width=80, compact=True) | |
pp.pprint(data) | |
# def main ends here | |
if __name__ == '__main__': | |
main() | |
# finis |