Skip to content

Commit 9dcb156

Browse files
committed
Keep compatibility with older zarr versions
1 parent abdf455 commit 9dcb156

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/mudata/_core/io.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def write_zarr(
126126
from anndata._io.zarr import write_zarr as anndata_write_zarr
127127

128128
from .. import __anndataversion__, __mudataversion__, __version__
129+
129130
zarr_format = 2
130131
if hasattr(settings, "zarr_write_format"):
131132
zarr_format = settings.zarr_write_format
@@ -136,7 +137,12 @@ def write_zarr(
136137
elif isinstance(data, MuData):
137138
if isinstance(store, Path):
138139
store = str(store)
139-
file = zarr.open(store, mode="w", zarr_format=zarr_format)
140+
zarr_format = kwargs.pop("zarr_format", zarr_format)
141+
try:
142+
file = zarr.open(store, mode="w", zarr_format=zarr_format)
143+
except TypeError:
144+
# zarr_format is not supported in this version of zarr
145+
file = zarr.open(store, mode="w")
140146
mdata = data
141147
write_elem(
142148
file,

0 commit comments

Comments
 (0)