mirror of https://github.com/QMCPACK/qmcpack.git
nexus: support loading pickle files created with Python 2
This commit is contained in:
parent
7ec4b00cc1
commit
e0d2b6dbbc
|
@ -30,6 +30,16 @@ if help:
|
|||
#end if
|
||||
|
||||
paths = dict()
|
||||
if len(paths_in)==1 and os.path.exists(paths_in[0]) and os.path.isfile(paths_in[0]):
|
||||
text = open(paths_in[0],'r').read()
|
||||
paths_in = []
|
||||
for line in text.splitlines():
|
||||
tokens = line.split()
|
||||
if len(tokens)>0:
|
||||
paths_in.append(tokens[-1])
|
||||
#end if
|
||||
#end for
|
||||
#end if
|
||||
for path in paths_in:
|
||||
if os.path.exists(path) and os.path.isdir(path):
|
||||
simdir = False
|
||||
|
|
|
@ -359,7 +359,11 @@ class object_interface(object):
|
|||
fpath='./'+self.__class__.__name__+'.p'
|
||||
#end if
|
||||
fobj = open(fpath,'rb')
|
||||
tmp = pickle.load(fobj)
|
||||
try:
|
||||
tmp = pickle.load(fobj)
|
||||
except:
|
||||
tmp = pickle.load(fobj,encoding='latin1')
|
||||
#end try
|
||||
fobj.close()
|
||||
d = self.__dict__
|
||||
d.clear()
|
||||
|
@ -372,7 +376,6 @@ class object_interface(object):
|
|||
#end def load
|
||||
|
||||
|
||||
|
||||
# log, warning, and error messages
|
||||
def open_log(self,filepath):
|
||||
self._logfile = open(filepath,'w')
|
||||
|
|
Loading…
Reference in New Issue