mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-27 13:56:23 +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)
|
||||
else:
|
||||
m = pickle.load(file_or_path)
|
||||
except:
|
||||
import pickle
|
||||
except: # python3
|
||||
import pickle
|
||||
if isinstance(file_or_path, str):
|
||||
with open(file_or_path, 'rb') as f:
|
||||
m = pickle.load(f)
|
||||
u = pickle._Unpickler(f) # @UndefinedVariable
|
||||
u.encoding = 'latin1'
|
||||
m = u.load()
|
||||
else:
|
||||
m = pickle.load(file_or_path)
|
||||
u = pickle._Unpickler(file_or_path) # @UndefinedVariable
|
||||
u.encoding = 'latin1'
|
||||
m = u.load()
|
||||
return m
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue