Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compatibility problem when read pickle file in example.py #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion traj_dist/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import traj_dist.distance as tdist
import pickle

traj_list = pickle.load(open("/Users/bguillouet/These/trajectory_distance/data/benchmark_trajectories.pkl", "rb"))[:10]
#because pickle compatibility problem between python 3.6 and python 2.7,we should use this way to open old pkl file
#refer https://stackoverflow.com/questions/11305790/pickle-incompatibility-of-numpy-arrays-between-python-2-and-3?newreg=8c4b4c32700e4119a3735ecd1f0bb5ca
with open('/Users/bguillouet/These/trajectory_distance/data/benchmark_trajectories.pkl', 'rb') as f:
u = pickle._Unpickler(f)
u.encoding = 'latin1'
traj_list = u.load()[:10]
traj_A = traj_list[0]
traj_B = traj_list[1]

Expand Down