Unverified Commit d948ff3f authored by WYLDYR's avatar WYLDYR Committed by GitHub
Browse files

Fixes binary write mode for Python3 and Windows (#8094)

parent d33a0b42
...@@ -184,7 +184,7 @@ def write_data(data_fname, data_dict, use_json=False, compression=None): ...@@ -184,7 +184,7 @@ def write_data(data_fname, data_dict, use_json=False, compression=None):
os.makedirs(dir_name) os.makedirs(dir_name)
if use_json: if use_json:
the_file = open(data_fname,'w') the_file = open(data_fname,'wb')
json.dump(data_dict, the_file) json.dump(data_dict, the_file)
the_file.close() the_file.close()
else: else:
......
...@@ -74,9 +74,9 @@ class ReplayBuffer(object): ...@@ -74,9 +74,9 @@ class ReplayBuffer(object):
def _save(datas, fnames): def _save(datas, fnames):
print("saving replay buffer...") print("saving replay buffer...")
for data, fname in zip(datas, fnames): for data, fname in zip(datas, fnames):
with open("%s.npz"%fname, "w") as f: with open("%s.npz"%fname, "wb") as f:
pickle.dump(data, f) pickle.dump(data, f)
with open("%s/%s.count" % (path,name), "w") as f: with open("%s/%s.count" % (path,name), "wb") as f:
f.write(str(self.count)) f.write(str(self.count))
print("...done saving.") print("...done saving.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment