pip install . (from origin/v3 branch at * ee303470 (HEAD, origin/v3, origin/HEAD) Feature: Top level V3 API (#1884)
Description
I'd like to be able to open a zarr group without having to know specify that it's zarr_version. E.g. 2 or 3.
See code below to reproduce
Steps to reproduce
test_read_v2.py
import zarr
import os
from zarr.v2 import open_group
path = "test.zarr"
if os.path.exists(path):
import shutil
shutil.rmtree(path)
# create v2 group
root = open_group(path, mode='w')
root.attrs["test"] = "v2"
foo = root.create_group('foo')
root2 = open_group(path, mode='a')
print('root2', root2)
# specify zarr_format - works
root = zarr.open(store=path, zarr_format=2)
print("root", root)
# try to guess zarr_format - fails
root = zarr.open(store=path)
print("root", root)
Additional output
$ python test_read_v2.py
root2 <zarr.v2.hierarchy.Group '/'>
root Group(_async_group=<AsyncGroup file://test.zarr>)
Traceback (most recent call last):
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/api/asynchronous.py", line 198, in open
return await open_array(store=store_path, zarr_format=zarr_format, **kwargs)
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/api/asynchronous.py", line 865, in open_array
raise e
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/api/asynchronous.py", line 860, in open_array
return await AsyncArray.open(store_path, zarr_format=zarr_format)
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/array.py", line 337, in open
raise KeyError(store_path) # filenotfounderror?
KeyError: StorePath(LocalStore, 'file://test.zarr')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/wmoore/Desktop/ZARR/scripts/test_read_v2.py", line 23, in <module>
root = zarr.open(store=path)
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/api/synchronous.py", line 45, in open
obj = sync(
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/sync.py", line 92, in sync
raise return_result
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/sync.py", line 51, in _runner
return await coro
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/api/asynchronous.py", line 200, in open
return await open_group(store=store_path, zarr_format=zarr_format, **kwargs)
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/abc/store.py", line 203, in set_or_delete
await byte_setter.set(value)
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/store/core.py", line 40, in set
await self.store.set(self.path, value)
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/store/local.py", line 128, in set
self._check_writable()
File "/Users/wmoore/opt/anaconda3/envs/zarr_v3/lib/python3.10/site-packages/zarr/abc/store.py", line 29, in _check_writable
raise ValueError("store mode does not support writing")
ValueError: store mode does not support writing
Zarr version
2.16.2.dev137+gcf37b134
Numcodecs version
0.12.1
Python Version
3.10.14
Operating System
Mac
Installation
pip install . (from origin/v3 branch at * ee303470 (HEAD, origin/v3, origin/HEAD) Feature: Top level V3 API (#1884)
Description
I'd like to be able to open a zarr group without having to know specify that it's
zarr_version
. E.g. 2 or 3.See code below to reproduce
Steps to reproduce
test_read_v2.py
Additional output