Skip to content

Commit 120a6bc

Browse files
Suppress FileNotFoundError when deleting keys in the obstore adapter
1 parent 2911be8 commit 120a6bc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/zarr/storage/_obstore.py

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

190190
self._check_writable()
191-
await obs.delete_async(self.store, key)
191+
192+
# Some stores such as local filesystems, GCP and Azure raise an error
193+
# when deleting a non-existent key, while others such as S3 and in-memory do
194+
# not. We suppress the error to make the behavior consistent across all stores
195+
with contextlib.suppress(FileNotFoundError):
196+
await obs.delete_async(self.store, key)
192197

193198
@property
194199
def supports_partial_writes(self) -> bool:

0 commit comments

Comments
 (0)