diff --git a/zarr/storage.py b/zarr/storage.py index 656b05acf8..a3ac507c56 100644 --- a/zarr/storage.py +++ b/zarr/storage.py @@ -23,6 +23,7 @@ import zipfile import shutil import atexit +import errno import re import sys import json @@ -745,8 +746,9 @@ def __setitem__(self, key, value): if not os.path.exists(dir_path): try: os.makedirs(dir_path) - except Exception: - raise KeyError(key) + except OSError as e: + if e.errno != errno.EEXIST: + raise KeyError(key) # write to temporary file temp_path = None diff --git a/zarr/tests/data/store.zip b/zarr/tests/data/store.zip new file mode 100644 index 0000000000..a36fd675b3 Binary files /dev/null and b/zarr/tests/data/store.zip differ diff --git a/zarr/tests/data/store/foo b/zarr/tests/data/store/foo new file mode 100644 index 0000000000..ba0e162e1c --- /dev/null +++ b/zarr/tests/data/store/foo @@ -0,0 +1 @@ +bar \ No newline at end of file