Skip to content

[Bug]:  #255

Closed
Closed
@rcpeene

Description

@rcpeene

What happened?

I am trying to open a zarr nwb in order to append CCF information to the electrodes table, but it fails to open.

Note that .zmetadata is present in the Zarr NWB file. It's worth mentioning that I generated this hdmf-zarr==0.8.0 but and now trying to open it with latest (0.10.0), perhaps that is causing this.

Steps to Reproduce

Run the following code snippet, where there is a Zarr NWB present at `scratch_nwb_path`


    print('Reading NWB in append mode:', scratch_nwb_path)
    print(os.listdir(scratch_folder))
    if scratch_nwb_path.is_dir():
        print(os.listdir(scratch_nwb_path))
    with NWBZarrIO(str(scratch_nwb_path), mode='a') as read_io:
        nwb = read_io.read()

Traceback

Reading NWB in append mode: ../scratch/ecephys_747816_2024-08-14_13-57-37_experiment1_recording1.nwb
['ecephys_747816_2024-08-14_13-57-37_experiment1_recording1.nwb']
['file_create_date', 'intervals', 'analysis', 'specifications', 'stimulus', '.zattrs', 'general', 'acquisition', '.zmetadata', '.zgroup', 'processing', 'timestamps_reference_time', 'identifier', 'units', 'session_description', 'session_start_time']
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 566, in __open_file_consolidated
    return zarr.open_consolidated(
  File "/opt/conda/lib/python3.9/site-packages/zarr/convenience.py", line 1360, in open_consolidated
    meta_store = ConsolidatedStoreClass(store, metadata_key=metadata_key)
  File "/opt/conda/lib/python3.9/site-packages/zarr/storage.py", line 3046, in __init__
    meta = json_loads(self.store[metadata_key])
  File "/opt/conda/lib/python3.9/site-packages/zarr/storage.py", line 1120, in __getitem__
    raise KeyError(key)
KeyError: '.zmetadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/capsule/code/run_capsule.py", line 140, in <module>
    if __name__ == "__main__": run()
  File "/root/capsule/code/run_capsule.py", line 124, in run
    nwb = read_io.read()
  File "/opt/conda/lib/python3.9/site-packages/hdmf/utils.py", line 668, in func_call
    return func(args[0], **pargs)
  File "/opt/conda/lib/python3.9/site-packages/hdmf/backends/io.py", line 56, in read
    f_builder = self.read_builder()
  File "/opt/conda/lib/python3.9/site-packages/hdmf/utils.py", line 668, in func_call
    return func(args[0], **pargs)
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 1470, in read_builder
    f_builder = self.__read_group(self.__file, ROOT_NAME)
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 1548, in __read_group
    sub_builder = self.__read_group(sub_group, sub_name)
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 1548, in __read_group
    sub_builder = self.__read_group(sub_group, sub_name)
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 1557, in __read_group
    self.__read_links(zarr_obj=zarr_obj, parent=ret)
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 1576, in __read_links
    target_name, target_zarr_obj = self.resolve_ref(link)
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 822, in resolve_ref
    target_zarr_obj = self.__open_file_consolidated(
  File "/opt/conda/lib/python3.9/site-packages/hdmf_zarr/backend.py", line 573, in __open_file_consolidated
    return zarr.open(
  File "/opt/conda/lib/python3.9/site-packages/zarr/convenience.py", line 137, in open
    raise PathNotFoundError(path)
zarr.errors.PathNotFoundError: nothing found at path ''
(base) root@a09d29db9803:~/capsule/code# 


### Operating System

Windows

### Python Version

3.9

### Package Versions

_No response_

Metadata

Metadata

Assignees

Labels

category: bugerrors in the code or code behaviorpriority: highimpacts proper operation or use of feature important to most users

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions