Skip to content

Commit b717865

Browse files
committed
Add version check for h5py
1 parent 4a75a84 commit b717865

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

neo/io/hdf5io.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
import logging
8+
from distutils.version import LooseVersion
89
import pickle
910
import numpy as np
1011
import quantities as pq
@@ -23,7 +24,7 @@
2324
from neo.core.baseneo import MergeError
2425

2526
logger = logging.getLogger('Neo')
26-
27+
min_h5py_version = LooseVersion('2.6.0')
2728

2829
def disjoint_groups(groups):
2930
"""`groups` should be a list of sets"""
@@ -55,6 +56,10 @@ class NeoHdf5IO(BaseIO):
5556
def __init__(self, filename):
5657
if not HAVE_H5PY:
5758
raise ImportError("h5py is not available")
59+
if HAVE_H5PY:
60+
if LooseVersion(h5py.__version__) < min_h5py_version:
61+
raise ImportError('h5py version {} is too old. Minimal required version is {}'
62+
''.format(h5py.__version__, min_h5py_version))
5863
BaseIO.__init__(self, filename=filename)
5964
self._data = h5py.File(filename, 'r')
6065
self.object_refs = {}

0 commit comments

Comments
 (0)