'Pickle not using stated protocol
I have a script I'm writing where I save three arrays to a pickle file using Python 3.x. However, I need to read it as input to a file that uses Python 2.7.x.
out_fname = 'home/mydirectory/Tray/data/TrayConverted.pkl.gz'
datasave = gzip.open('TrayConverted.pkl.gz','wb')
pickle.dump(startX, datasave, protocol=2)
pickle.dump(startY, datasave, protocol=2)
pickle.dump(startZ, datasave, protocol=2)
datasave.close()
Previously this has worked fine. As far as anyone is aware neither Python has been updated.
However, when I go to load it in, I get the following error.
ValueError: unsupported pickle protocol: 3
So clearly it is saving as protocol 3, but why would that be and how do I fix it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
