Pickle protocol incompatible with Python 2.7 when reading in files
There is an issue when trying to read in results with Python 2. If you run:
import tupak
results = tupak.result.read_in_result('outdir', 'basic_tutorial')
You will get this error:
Traceback (most recent call last):
File "/home/moritz/opt/pycharm-2018.1.2/helpers/pydev/pydev_run_in_console.py", line 52, in run_file
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/moritz/Dropbox/PhD/PythonProjects/Tupak/tupak/examples/injection_examples/test_result_loading.py", line 6, in <module>
results = tupak.result.read_in_result(outdir, label)
File "/home/moritz/Dropbox/PhD/PythonProjects/Tupak/tupak/tupak/result.py", line 24, in read_in_result
return Result(deepdish.io.load(filename))
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 656, in load
pathtable=pathtable)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 319, in _load_specific_level
return _load_level(handler, getattr(grp, vv[0]), pathtable)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 482, in _load_level
pathname)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 370, in _load_nonlink_level
lev = _load_level(handler, grp, pathtable)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 482, in _load_level
pathname)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 370, in _load_nonlink_level
lev = _load_level(handler, grp, pathtable)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 482, in _load_level
pathname)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 437, in _load_nonlink_level
return _load_pickled(level)
File "/home/moritz/.local/lib/python2.7/site-packages/deepdish/io/hdf5io.py", line 343, in _load_pickled
if isinstance(level[0], ForcePickle):
File "/home/moritz/.local/lib/python2.7/site-packages/tables/vlarray.py", line 681, in __getitem__
return self.read(start, stop, step)[0]
File "/home/moritz/.local/lib/python2.7/site-packages/tables/vlarray.py", line 825, in read
outlistarr = [atom.fromarray(arr) for arr in listarr]
File "/home/moritz/.local/lib/python2.7/site-packages/tables/atom.py", line 1228, in fromarray
return six.moves.cPickle.loads(array.tostring())
ValueError: unsupported pickle protocol: 4
The issue is that this pickle protocol is simply not implemented for Python 2.