2

I want to be able to retrieve the location of the script that created a certain pickle file. This happens especially if I work on a project, then stop, and after some time I need to come back.

In these cases, wouldn't it be easier if we could retrieve the script path by simply right-clicking on the pickle file we are working with, and read the path from the Properties->Details tab of the file?

  • If you create the following numpy array, which is meant to represent any object, and save it as a pickle, is there a way to add to the file details the path of the generating script?

    #Generating script: C:\Users\MyName\Desktop\hopethisworks.py
    import numpy
    import pickle
    
    a=numpy.array([1,2,3,4,5,6])
    
    with open('myarray.pickle', 'wb') as handle:
        pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)
    
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
  • 2
    This is not special to `numpy` or `pickle`. It's about writing to the Window's properties from Python. – hpaulj May 09 '17 at 17:17
  • 1
    You may need a 3rd party package like `win32ext` (I'm have trouble finding documentation on that without downloading the whole thing). – hpaulj May 09 '17 at 17:36
  • 1
    http://stackoverflow.com/questions/12521525/reading-metadata-with-python - seems to have the best answer on accessing the windows file metadata. – hpaulj May 09 '17 at 23:10

0 Answers0