pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

[Bug] `NWBHDF5IO.can_read()` fails for missing version

Open h-mayorquin opened this issue 8 months ago • 3 comments

As in the title, the problem is the following, NWBHDF5IO.can_read() relies on get_nwbfile_version and critically it indexes the output:

https://github.com/NeurodataWithoutBorders/pynwb/blob/90e60484415d38d3d566dc9fea63b6d99ffdbe43/src/pynwb/init.py#L272

However, get_nwbfile_version can also return None and then the indexing fails:

https://github.com/NeurodataWithoutBorders/pynwb/blob/90e60484415d38d3d566dc9fea63b6d99ffdbe43/src/pynwb/init.py#L183

It seems to me that the solution should be that if get_nwbfile_version returns None then NWBHDF5IO.can_read() should return None instead of trying to index.

From the discussion in neuroconv:

https://github.com/catalystneuro/neuroconv/issues/910

h-mayorquin avatar Jun 13 '24 20:06 h-mayorquin