Skip to content

Commit c20b139

Browse files
committed
PEP 3151
1 parent 1dc3b73 commit c20b139

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

astroquery/image_cutouts/first/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_images(self, coordinates, image_size=1 * u.arcmin,
6767
S = BytesIO(response.content)
6868
try:
6969
return fits.open(S, ignore_missing_end=True)
70-
except IOError:
70+
except OSError:
7171
raise InvalidQueryError(response.content)
7272

7373
@prepend_docstr_nosections("\n" + _args_to_payload.__doc__)

astroquery/magpis/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_images(self, coordinates, image_size=1 * u.arcmin,
9090
content_buffer = BytesIO(response.content)
9191
try:
9292
return fits.open(content_buffer, ignore_missing_end=True)
93-
except IOError:
93+
except OSError:
9494
raise InvalidQueryError(response.content)
9595

9696
@prepend_docstr_nosections("\n" + _args_to_payload.__doc__)

astroquery/nasa_ads/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def _get_token(self):
123123
with open(token_file) as f:
124124
self.TOKEN = f.read().strip()
125125
return self.TOKEN
126-
except IOError:
126+
except OSError:
127127
raise RuntimeError('No API token found! Get yours from: '
128128
'https://ui.adsabs.harvard.edu/#user/settings/token '
129129
'and store it in the API_DEV_KEY environment variable.')

astroquery/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def from_cache(self, cache_location):
114114
response = pickle.load(f)
115115
if not isinstance(response, requests.Response):
116116
response = None
117-
except IOError: # TODO: change to FileNotFoundError once drop py2 support
117+
except OSError: # TODO: change to FileNotFoundError once drop py2 support
118118
response = None
119119
if response:
120120
log.debug("Retrieving data from {0}".format(request_file))

astroquery/utils/commons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def save_fits(self, savepath, link_cache='hard'):
408408
if link_cache == 'hard':
409409
try:
410410
os.link(target, savepath)
411-
except (IOError, OSError, AttributeError):
411+
except (OSError, AttributeError):
412412
shutil.copy(target, savepath)
413413
elif link_cache == 'sym':
414414
try:

astroquery/utils/download_file_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def download_list_of_fitsfiles(linklist, output_directory=None,
7171
try:
7272
# try to open as a fits file
7373
fitsfile = fits.open(S, ignore_missing_end=True)
74-
except IOError:
74+
except OSError:
7575
# if that fails, try to open as a gzip'd fits file
7676
# have to rewind to the start
7777
S.seek(0)
@@ -117,7 +117,7 @@ def download_list_of_fitsfiles(linklist, output_directory=None,
117117

118118
try:
119119
fitsfile.writeto(final_file, clobber=overwrite)
120-
except IOError:
120+
except OSError:
121121
print("Skipped writing file {0} because it exists "
122122
"and overwrite=False".format(final_file))
123123

astroquery/utils/progressbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def retrieve(url, outfile, opener=None, overwrite=False):
6666
S = StringIO(results)
6767
try:
6868
fitsfile = fits.open(S, ignore_missing_end=True)
69-
except IOError:
69+
except OSError:
7070
S.seek(0)
7171
G = gzip.GzipFile(fileobj=S)
7272
fitsfile = fits.open(G, ignore_missing_end=True)

astroquery/vo_conesearch/validator/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def check_conesearch_sites(destdir=os.curdir, verbose=True, parallel=True,
7272
7373
Raises
7474
------
75-
IOError
75+
OSError
7676
Invalid destination directory.
7777
7878
timeout
@@ -87,7 +87,7 @@ def check_conesearch_sites(destdir=os.curdir, verbose=True, parallel=True,
8787

8888
if (not isinstance(destdir, str) or len(destdir) == 0
8989
or os.path.exists(destdir) and not os.path.isdir(destdir)):
90-
raise IOError('Invalid destination directory') # pragma: no cover
90+
raise OSError('Invalid destination directory') # pragma: no cover
9191

9292
if not os.path.exists(destdir):
9393
os.mkdir(destdir)

0 commit comments

Comments
 (0)