From 18bc6f7b0c6ccc217d454e299122ea2b6309ac7f Mon Sep 17 00:00:00 2001 From: Nathan Zimmerman Date: Wed, 4 Dec 2024 12:17:44 -0600 Subject: [PATCH] Wrap sync fs for xarray.to_zarr --- src/zarr/storage/remote.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/zarr/storage/remote.py b/src/zarr/storage/remote.py index 2b8329c9fa..7f307ccd1e 100644 --- a/src/zarr/storage/remote.py +++ b/src/zarr/storage/remote.py @@ -166,6 +166,9 @@ def from_url( opts = {"asynchronous": True, **opts} fs, path = url_to_fs(url, **opts) + if not fs.async_impl: + from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper + fs = AsyncFileSystemWrapper(fs) # fsspec is not consistent about removing the scheme from the path, so check and strip it here # https://github.com/fsspec/filesystem_spec/issues/1722