mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-27 22:06:22 +02:00
[unpickle] with latin1 encoding
This commit is contained in:
commit
3e0dcf9317
1 changed files with 8 additions and 4 deletions
|
|
@ -59,11 +59,15 @@ def load(file_or_path):
|
||||||
m = pickle.load(f)
|
m = pickle.load(f)
|
||||||
else:
|
else:
|
||||||
m = pickle.load(file_or_path)
|
m = pickle.load(file_or_path)
|
||||||
except:
|
except: # python3
|
||||||
import pickle
|
import pickle
|
||||||
if isinstance(file_or_path, str):
|
if isinstance(file_or_path, str):
|
||||||
with open(file_or_path, 'rb') as f:
|
with open(file_or_path, 'rb') as f:
|
||||||
m = pickle.load(f)
|
u = pickle._Unpickler(f) # @UndefinedVariable
|
||||||
|
u.encoding = 'latin1'
|
||||||
|
m = u.load()
|
||||||
else:
|
else:
|
||||||
m = pickle.load(file_or_path)
|
u = pickle._Unpickler(file_or_path) # @UndefinedVariable
|
||||||
|
u.encoding = 'latin1'
|
||||||
|
m = u.load()
|
||||||
return m
|
return m
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue