eelbrain.load.convert_pickle_protocol
- eelbrain.load.convert_pickle_protocol(root=None, to_protocol=4, pattern='**/*.pickle')
Load and re-save pickle files with a specific protocol
- Parameters
Notes
Python 3.8 introduced a new pickle protocol 5, which older versions of Python can’t read. Trying to unpickle such files results in the following error:
ValueError: unsupported pickle protocol: 5
A simple solution to make those files readable in Python 3.7 and below is to use Python 3.8 to load these files and re-save them with a lower protocol version (e.g., version 4). The
convert_pickle_protocol
function allows doing that for a large number of files with a single command (by default, to all files in theroot
directory).