Skip to content

FIX: Detect IndexedGzipFile as compressed file type #925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions nibabel/openers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions nibabel/volumeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand Down