Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 group read file not found error #2480

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,11 @@ async def open(

try:
return await open_array(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
except (KeyError, NodeTypeValidationError):
except (KeyError, NodeTypeValidationError, FileNotFoundError):
# KeyError for a missing key
# NodeTypeValidationError for failing to parse node metadata as an array when it's
# actually a group
# FileNotFoundError for v2 when opening a group
return await open_group(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)


Expand Down
9 changes: 8 additions & 1 deletion tests/test_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import zarr
import zarr.storage
from zarr import Array
from zarr.storage import MemoryStore, StorePath
from zarr.storage import LocalStore, MemoryStore, StorePath


@pytest.fixture
Expand All @@ -35,6 +35,13 @@ def test_simple(store: StorePath) -> None:
assert np.array_equal(data, a[:, :])


def test_simple_group(tmp_path) -> None:
store = LocalStore(tmp_path, mode="w")
zarr.group(store=store, zarr_format=2)
root_group = zarr.open(tmp_path, zarr_format=2)
assert root_group is not None


@pytest.mark.parametrize(
("dtype", "fill_value"),
[
Expand Down
Loading