Skip to content

Commit

Permalink
Merge pull request #83 from NLeSC/h5py_file
Browse files Browse the repository at this point in the history
add explicit h5py File mode
  • Loading branch information
jhidding committed Oct 26, 2020
2 parents 2727f54 + 4668ea2 commit 540ba9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions noodles/serial/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self, filename, lockfile):
def encode(self, obj, make_rec):
key = array_sha256(obj)
with self.lock:
f = h5py.File(self.filename)
f = h5py.File(self.filename, 'a')
path = next(
(ds for ds in f if f[ds].attrs.get('hash') == key),
False)
Expand All @@ -99,7 +99,7 @@ def encode(self, obj, make_rec):

def decode(self, cls, data):
with self.lock:
f = h5py.File(self.filename)
f = h5py.File(self.filename, 'r')
obj = f[data["path"]].value
f.close()

Expand Down

0 comments on commit 540ba9e

Please sign in to comment.