Skip to content

Commit a1d2182

Browse files
committed
only set default mode for versions older than 3.3
1 parent 98955d9 commit a1d2182

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

qiita_files/util.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
import h5py
1212

1313

14-
# not present in all 2.x series
15-
if hasattr(h5py.get_config(), 'default_file_mode'):
16-
h5py.get_config().default_file_mode = 'r'
14+
# deprecated sind h5py 3.3,
15+
# see https://docs.h5py.org/en/stable/whatsnew/3.6.html
16+
h5py_version = list(map(int, h5py.__version__.split('.')))
17+
if h5py_version < [3, 3, 0]:
18+
# not present in all 2.x series
19+
if hasattr(h5py.get_config(), 'default_file_mode'):
20+
h5py.get_config().default_file_mode = 'r'
1721

1822

1923
def _is_string_or_bytes(s):

0 commit comments

Comments
 (0)