Skip to content

Commit c1c1fe4

Browse files
Suppress FileNotFoundError when deleting keys in the obstore adapter
1 parent 6798466 commit c1c1fe4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/zarr/storage/_obstore.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ async def delete(self, key: str) -> None:
181181
import obstore as obs
182182

183183
self._check_writable()
184-
await obs.delete_async(self.store, key)
184+
185+
# Some stores such as local filesystems, GCP and Azure raise an error
186+
# when deleting a non-existent key, while others such as S3 and in-memory do
187+
# not. We suppress the error to make the behavior consistent across all stores
188+
with contextlib.suppress(FileNotFoundError):
189+
await obs.delete_async(self.store, key)
185190

186191
@property
187192
def supports_partial_writes(self) -> bool:

0 commit comments

Comments
 (0)