Skip to content

Commit

Permalink
Merge pull request #113 from silx-kit/support-older-libhdf5
Browse files Browse the repository at this point in the history
Supports libhdf5 versions before v1.10.7 and 1.12.1
  • Loading branch information
t20100 authored May 15, 2023
2 parents 5823d42 + 2be7010 commit ca7ba19
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jupyterlab_h5web/handlers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import h5py
from tornado.web import authenticated, MissingArgumentError
from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
Expand All @@ -15,6 +16,12 @@
from .utils import as_absolute_path, create_error


H5PY_HAS_FILE_LOCKING_ARG = h5py.version.hdf5_version_tuple >= (1, 12, 1) or (
h5py.version.hdf5_version_tuple[:2] == (1, 10)
and h5py.version.hdf5_version_tuple[2] >= 7
)


class BaseHandler(APIHandler):
def initialize(self, base_dir: Path) -> None:
self.base_dir = base_dir
Expand All @@ -33,7 +40,7 @@ def get(self):
as_absolute_path(self.base_dir, Path(file_path)),
path,
create_error,
h5py_options={"locking": False},
h5py_options={"locking": False} if H5PY_HAS_FILE_LOCKING_ARG else {},
) as content:
payload = self.parse_content(content)

Expand Down

0 comments on commit ca7ba19

Please sign in to comment.