Skip to content

Commit 7795c8d

Browse files
committed
Reverted Exceptions in utils.data and io.fits docs.
1 parent dbbc863 commit 7795c8d

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎astropy/utils/data.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@ def get_readable_fileobj(name_or_obj, encoding=None, cache=False,
280280
except ImportError:
281281
for fd in close_fds:
282282
fd.close()
283-
raise ModuleNotFoundError(
284-
"This Python installation does not provide the bz2 module.")
283+
raise ValueError(
284+
".bz2 format files are not supported since the Python "
285+
"interpreter does not include the bz2 module")
285286
try:
286287
# bz2.BZ2File does not support file objects, only filenames, so we
287288
# need to write the data to a temporary file
@@ -306,8 +307,9 @@ def get_readable_fileobj(name_or_obj, encoding=None, cache=False,
306307
except ImportError:
307308
for fd in close_fds:
308309
fd.close()
309-
raise ModuleNotFoundError(
310-
"This Python installation does not provide the lzma module.")
310+
raise ValueError(
311+
".xz format files are not supported since the Python "
312+
"interpreter does not include the lzma module.")
311313
except (OSError, EOFError): # invalid xz file
312314
fileobj.seek(0)
313315
fileobj_new.close()

‎docs/io/fits/index.rst‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ Working with compressed files
168168
The :func:`open` function will seamlessly open FITS files that have been
169169
compressed with gzip, bzip2 or pkzip. Note that in this context we are talking
170170
about a FITS file that has been compressed with one of these utilities (e.g., a
171-
.fits.gz file). Opening bzip2-compressed files requires the :mod:`bz2` module
172-
to be available.
171+
.fits.gz file).
173172

174173
There are some limitations when working with compressed files. For example,
175174
with Zip files that contain multiple compressed files, only the first file will

0 commit comments

Comments
 (0)