Skip to content

[Bug]: PyNWB validation fails on Zarr data: 'NWBZarrIO' object has no attribute '_file' #293

@rly

Description

@rly

What happened?

Validating a Zarr NWB file with pynwb fails. Related to NeurodataWithoutBorders/pynwb#2119

As a quick fix, I suggest we add attribute _file while the other changes in hdmf-dev/hdmf#1299 and #292 are gradually merged (the HDMF change is a major breaking change).

Steps to Reproduce

with hdmf_zarr.NWBZarrIO(path=nwbfile_path, mode="r") as io:
    invalidations = pynwb.validate(io=io)

Traceback

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/Users/rly/Documents/NWB/hdmf/src/hdmf/utils.py", line 582, in func_call
    return func(**pargs)
           ^^^^^^^^^^^^^
  File "/Users/rly/Documents/NWB/pynwb/src/pynwb/validation.py", line 165, in validate
    validation_errors = _validate_single_file(path=path, **kwargs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rly/Documents/NWB/pynwb/src/pynwb/validation.py", line 183, in _validate_single_file
    cached_namespaces, manager, namespace_dependencies = get_cached_namespaces_to_validate(path=path, 
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rly/Documents/NWB/pynwb/src/pynwb/validation.py", line 66, in get_cached_namespaces_to_validate
    file=io._file)
         ^^^^^^^^
AttributeError: 'NWBZarrIO' object has no attribute '_file'. Did you mean: 'file'?

Operating System

macOS

Python Version

3.13

Package Versions

No response

Metadata

Metadata

Assignees

Labels

category: bugerrors in the code or code behaviorpriority: mediumnon-critical problem and/or affecting only a small set of users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions