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

Zarr v3.0.0a7 fail to open group dataset #2309

Closed
Czaki opened this issue Oct 8, 2024 · 1 comment · Fixed by #2310
Closed

Zarr v3.0.0a7 fail to open group dataset #2309

Czaki opened this issue Oct 8, 2024 · 1 comment · Fixed by #2310
Labels
bug Potential issues with the zarr-python library

Comments

@Czaki
Copy link

Czaki commented Oct 8, 2024

Zarr version

3.0.0a7

Numcodecs version

0.13.0

Python Version

3.12

Operating System

All

Installation

pip install --pre

Description

When open zarr dataset using image = zarr.open(store=path) ends with error ValueError: Invalid value. Expected 'array'. Got group.

This guard is expecting key error, not value error:

try:
return await open_array(store=store_path, zarr_format=zarr_format, **kwargs)
except KeyError:
return await open_group(store=store_path, zarr_format=zarr_format, **kwargs)

napari_builtins/_tests/test_io.py:121:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
napari_builtins/io/_read.py:225: in magic_imread
    image, zarr_shape = read_zarr_dataset(filename)
napari_builtins/io/_read.py:140: in read_zarr_dataset
    image = zarr.open(store=path)
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/_compat.py:43: in inner_f
    return f(*args, **kwargs)
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/api/synchronous.py:77: in open
    obj = sync(
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/core/sync.py:91: in sync
    raise return_result
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/core/sync.py:50: in _runner
    return await coro
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/api/asynchronous.py:249: in open
    return await open_array(store=store_path, zarr_format=zarr_format, **kwargs)
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/api/asynchronous.py:966: in open_array
    return await AsyncArray.open(store_path, zarr_format=zarr_format)
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/core/array.py:405: in open
    return cls(store_path=store_path, metadata=metadata_dict)
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/core/array.py:181: in __init__
    metadata = ArrayV3Metadata.from_dict(metadata)
/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/core/metadata/v3.py:270: in from_dict
    _ = parse_node_type_array(_data.pop("node_type"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

data = 'group'

    def parse_node_type_array(data: object) -> Literal["array"]:
        if data == "array":
            return "array"
>       raise ValueError(f"Invalid value. Expected 'array'. Got {data}.")
E       ValueError: Invalid value. Expected 'array'. Got group.

/tmp/.tox/py312-linux-pyqt5-no_cov/lib/python3.12/site-packages/zarr/core/metadata/v3.py:45: ValueError

Steps to reproduce

Run test_zarr_multiscale from napari_builtins/_tests/test_io.py

Additional output

followup to #2158

required for napari/napari#7215

@Czaki Czaki added the bug Potential issues with the zarr-python library label Oct 8, 2024
TomAugspurger added a commit to TomAugspurger/zarr-python that referenced this issue Oct 8, 2024
@TomAugspurger
Copy link
Contributor

Thanks for the report. #2310 has a quick fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants