Brian Blais wrote:
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 name "dtypedescr" was changed to "dtype" back in early February. The problem with pickle is that it is quite sensitive to these kind of changes. These kind of changes are actually rare, but in the early stages of NumPy, more common. This should be more stable now. I don't expect changes that will cause pickled NumPy arrays to fail in the future. If you needed to read the data on these files, it is likely possible with a little tweaking. While pickle is convenient and the actual data is guaranteed to be readable, reconstructing the data requires that certain names won't change. Many people use other methods for persistence because of this. -Travis