Skip to content

Commit

Permalink
fix load pickle for python2 and python3
Browse files Browse the repository at this point in the history
  • Loading branch information
mjirik committed Apr 18, 2018
1 parent 64f3508 commit 36cdb14
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion io3d/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def obj_from_file(filename='annotation.yaml', filetype='auto'):
else:
import _pickle as pickle
# import sPickle as pickle
obj = pickle.loads(fcontent, encoding="latin1")
if sys.version_info.major == 2:
obj = pickle.loads(fcontent)
else:
obj = pickle.loads(fcontent, encoding="latin1")
else:
logger.error('Unknown filetype ' + filetype)
return obj
Expand Down

0 comments on commit 36cdb14

Please sign in to comment.