diff --git a/nibabel/openers.py b/nibabel/openers.py index a658c65c0a..ed9568c694 100644 --- a/nibabel/openers.py +++ b/nibabel/openers.py @@ -35,6 +35,9 @@ del igzip, version except ImportError: + # nibabel.openers.IndexedGzipFile is imported by nibabel.volumeutils + # to detect compressed file types, so we give a fallback value here. + IndexedGzipFile = gzip.GzipFile HAVE_INDEXED_GZIP = False diff --git a/nibabel/volumeutils.py b/nibabel/volumeutils.py index c3a82db418..5852084ecd 100644 --- a/nibabel/volumeutils.py +++ b/nibabel/volumeutils.py @@ -19,7 +19,7 @@ import numpy as np from .casting import (shared_range, type_info, OK_FLOATS) -from .openers import Opener, BZ2File +from .openers import Opener, BZ2File, IndexedGzipFile from .deprecated import deprecate_with_version from .externals.oset import OrderedSet @@ -38,7 +38,7 @@ default_compresslevel = 1 #: file-like classes known to hold compressed data -COMPRESSED_FILE_LIKES = (gzip.GzipFile, BZ2File) +COMPRESSED_FILE_LIKES = (gzip.GzipFile, BZ2File, IndexedGzipFile) class Recoder(object):