[Numpy-discussion] saving data: which format is recommended?

Brian Blais bblais at bryant.edu
Mon May 22 09:50:02 EDT 2006


Hello,

I am trying to save numpy arrays (actually a list of them) for later use, and
distribution to others.  Up until yesterday, I've been using the zpickle module from
the Cookbook, which is just pickle binary format with gzip compression.  Yesterday, I
upgraded my operating system, and now I can't read those files.  I am using numpy
0.9.9.2536, and unfortunately I can't recall the version that I was using, but it was
pretty relatively recent.  I also upgraded from Python 2.3 to 2.4.  Trying to load
the "old" files, I get:

AttributeError: 'module' object has no attribute 'dtypedescr'


the file consists of a single dictionary, with two elements, like:

var={'im': numpy.zeros((5,5)),'im_scale_shift':[0.0,1.0]}

My question isn't how can I load these "old" files, because I can regenerate them.  I
would like to know what file format I should be using so that I don't have to worry
about upgrades/version differences when I want to load them.  Is there a preferred
way to do this?  I thought pickle was that way, but perhaps I don't understand how
pickle works.

thanks,

		Brian Blais





More information about the NumPy-Discussion mailing list