Skip to content

Comments

silx.io.url: h5pyd compatibility#4484

Open
felix-engelmann wants to merge 3 commits intosilx-kit:mainfrom
felix-engelmann:h5pyd-upgrade
Open

silx.io.url: h5pyd compatibility#4484
felix-engelmann wants to merge 3 commits intosilx-kit:mainfrom
felix-engelmann:h5pyd-upgrade

Conversation

@felix-engelmann
Copy link
Contributor

h5pyd changed their Config (HDFGroup/h5pyd@880721b) and the current version of silx with h5pyd>=0.20.0 no longer works and fails with an error:

$ silx view http://localhost:8000/  
ERROR:silx.app.view.main:An error occured in silx view:
ERROR:silx.app.view.main:<class 'AttributeError'> module 'h5pyd' has no attribute 'Config'   File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/bin/silx", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/__main__.py", line 76, in main
    status = launcher.execute(sys.argv)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/utils/launcher.py", line 289, in execute
    return command.execute(command_argv)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/utils/launcher.py", line 126, in execute
    status = func(argv)
             ^^^^^^^^^^
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/app/view/main.py", line 206, in main
    mainQt(options)
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/app/view/main.py", line 185, in mainQt
    window.appendFile(url.path())
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/app/view/Viewer.py", line 927, in appendFile
    self.__treeview.findHdf5TreeModel().appendFile(filename)
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/gui/hdf5/Hdf5TreeModel.py", line 808, in appendFile
    self.insertFile(filename, -1)
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/gui/hdf5/Hdf5TreeModel.py", line 792, in insertFile
    h5file = silx_io.open(filename)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/io/utils.py", line 701, in open
    return _open_url_with_h5pyd(filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/felix/Dokumente/maxiv/laptop/maxiv/projects/hdf5/silx/.venv/lib/python3.12/site-packages/silx/io/utils.py", line 611, in _open_url_with_h5pyd
    cfg = h5pyd.Config()
          ^^^^^^^^^^^^

This PR checks for availability of the new method and falls back to the old version. Therefore it should be compatible with older h5pyd versions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant