G-Node/nixpy

Upgrading 1.4.9 files fail

matham opened this issue · 1 comments

I have some files I created with 1.4.9, IIRC. I was trying to upgrade it with 1.5.0 and I got the following error:

$ nixio upgrade ceed/examples/data/2_stage_protocol.h5
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Python\Python37\Scripts\nixio.exe\__main__.py", line 7, in <module>
  File "e:\python\python37\lib\site-packages\nixio\cmd\main.py", line 42, in main
    cmdmap[cmd](args)
  File "e:\python\python37\lib\site-packages\nixio\cmd\upgrade.py", line 263, in main
    tasklist = collect_tasks(fname)
  File "e:\python\python37\lib\site-packages\nixio\cmd\upgrade.py", line 236, in collect_tasks
    alias_task = update_alias_range_dimension(fname)
  File "e:\python\python37\lib\site-packages\nixio\cmd\upgrade.py", line 146, in update_alias_range_dimension
    for data_array in block["data_arrays"].values():
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "e:\python\python37\lib\site-packages\h5py\_hl\group.py", line 264, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py\h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'data_arrays' doesn't exist)"

I'm not aware of any reason this would fail. Here's the file:
2_stage_protocol.zip.

Thanks!

Dear @matham, sorry for the inconvenience and thanks for the report. It seems the upgrade script fails when there are no DataArrays in the file (which it should survive), i.e. the data_array in block["data_arrays"].values() command fails.