Skip to content

Commit a7cc3c8

Browse files
committed
RF: Changed internally raised and eaten indexed_gzip version ImportError to a
warning, so it will be shown to users.
1 parent 33f6774 commit a7cc3c8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

nibabel/openers.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@
1212
import bz2
1313
import gzip
1414
import sys
15+
import warnings
1516
from os.path import splitext
1617
from distutils.version import StrictVersion
1718

1819
# is indexed_gzip present and modern?
1920
try:
2021
from indexed_gzip import SafeIndexedGzipFile, __version__ as version
2122

22-
if StrictVersion(version) < StrictVersion("0.6.0"):
23-
raise ImportError('indexed_gzip is present, but too old '
24-
'(>= 0.6.0 required): {})'.format(version))
23+
HAVE_INDEXED_GZIP = True
24+
25+
if StrictVersion(version) < StrictVersion('0.6.0'):
26+
warnings.warn('indexed_gzip is present, but too old '
27+
'(>= 0.6.0 required): {})'.format(version))
28+
HAVE_INDEXED_GZIP = False
2529

2630
del version
27-
HAVE_INDEXED_GZIP = True
2831

2932
except ImportError:
3033
HAVE_INDEXED_GZIP = False

0 commit comments

Comments
 (0)