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

[v3] Mode 'r+' is not working #1978

Closed
tomwhite opened this issue Jun 18, 2024 · 2 comments · Fixed by #2000
Closed

[v3] Mode 'r+' is not working #1978

tomwhite opened this issue Jun 18, 2024 · 2 comments · Fixed by #2000
Labels
bug Potential issues with the zarr-python library V3 Affects the v3 branch
Milestone

Comments

@tomwhite
Copy link
Contributor

Zarr version

3.0.0a1

Numcodecs version

0.12.1

Python Version

3.11.9

Operating System

Mac

Installation

pip

Description

It looks like 'r+', which should read or write to an existing store, doesn't work in v3. (Some of the other modes don't work either, like 'a', which should create the store for read/write if it doesn't exist.)

Steps to reproduce

>>> import zarr
>>> zarr.create(store='example-v3.zarr', shape=(3, 3))
<Array file://example-v3.zarr shape=(3, 3) dtype=float64>
>>> z = zarr.open(store='example-v3.zarr', mode='r+')
>>> z[:] = 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tom/workspace/zarr-python/src/zarr/array.py", line 720, in __setitem__
    self.set_basic_selection(cast(BasicSelection, pure_selection), value, fields=fields)
  File "/Users/tom/workspace/zarr-python/src/zarr/array.py", line 751, in set_basic_selection
    sync(self._async_array._set_selection(indexer, value, fields=fields, prototype=prototype))
  File "/Users/tom/workspace/zarr-python/src/zarr/sync.py", line 92, in sync
    raise return_result
  File "/Users/tom/workspace/zarr-python/src/zarr/sync.py", line 51, in _runner
    return await coro
           ^^^^^^^^^^
  File "/Users/tom/workspace/zarr-python/src/zarr/array.py", line 507, in _set_selection
    await self.metadata.codec_pipeline.write(
  File "/Users/tom/workspace/zarr-python/src/zarr/codecs/pipeline.py", line 504, in write
    await concurrent_map(
  File "/Users/tom/workspace/zarr-python/src/zarr/common.py", line 53, in concurrent_map
    return await asyncio.gather(*[func(*item) for item in items])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tom/workspace/zarr-python/src/zarr/codecs/pipeline.py", line 454, in write_batch
    await concurrent_map(
  File "/Users/tom/workspace/zarr-python/src/zarr/common.py", line 53, in concurrent_map
    return await asyncio.gather(*[func(*item) for item in items])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tom/workspace/zarr-python/src/zarr/codecs/pipeline.py", line 452, in _write_key
    await byte_setter.set(chunk_bytes)
  File "/Users/tom/workspace/zarr-python/src/zarr/store/core.py", line 40, in set
    await self.store.set(self.path, value)
  File "/Users/tom/workspace/zarr-python/src/zarr/store/local.py", line 128, in set
    self._check_writable()
  File "/Users/tom/workspace/zarr-python/src/zarr/abc/store.py", line 29, in _check_writable
    raise ValueError("store mode does not support writing")
ValueError: store mode does not support writing

Additional output

No response

@tomwhite tomwhite added the bug Potential issues with the zarr-python library label Jun 18, 2024
@jhamman jhamman added the V3 Affects the v3 branch label Jun 18, 2024
@jhamman jhamman added this to the 3.0.0 milestone Jun 18, 2024
@jhamman
Copy link
Member

jhamman commented Jun 18, 2024

Thanks for the report here @tomwhite. We'll get this addressed before the next release.

@tomwhite
Copy link
Contributor Author

Thanks @jhamman

@jhamman jhamman moved this to Todo in Zarr-Python - 3.0 Jun 28, 2024
@jhamman jhamman moved this from Todo to In Progress in Zarr-Python - 3.0 Jul 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Zarr-Python - 3.0 Jul 26, 2024
tomwhite added a commit to cubed-dev/cubed that referenced this issue Jul 29, 2024
tomwhite added a commit to cubed-dev/cubed that referenced this issue Jul 29, 2024
thodson-usgs pushed a commit to thodson-usgs/cubed that referenced this issue Oct 24, 2024
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 V3 Affects the v3 branch
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants