Skip to content

Commit 1f66707

Browse files
committed
ask for forgiveness
1 parent 1d502c0 commit 1f66707

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

zarr/attrs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ def __init__(self, store, key='.zattrs', read_only=False, cache=True,
2020
self.synchronizer = synchronizer
2121

2222
def _get(self):
23-
if self.key in self.store:
24-
d = json.loads(text_type(self.store[self.key], 'ascii'))
25-
else:
23+
try:
24+
data = self.store[self.key]
25+
except KeyError:
2626
d = dict()
27+
else:
28+
d = json.loads(text_type(data, 'ascii'))
2729
return d
2830

2931
def _put(self, d):

0 commit comments

Comments
 (0)