Skip to content
Merged
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
7 changes: 5 additions & 2 deletions astroquery/utils/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ def FK4CoordGenerator(*args, **kwargs):
'suppress_vo_warnings',
'validate_email',
'ASTROPY_LT_4_1',
'ASTROPY_LT_4_3']
'ASTROPY_LT_4_3',
'ASTROPY_LT_5_0']

ASTROPY_LT_4_1 = not minversion('astropy', '4.1')
ASTROPY_LT_4_3 = not minversion('astropy', '4.3')
ASTROPY_LT_5_0 = not minversion('astropy', '5.0')


@deprecated('0.4.4', alternative='astroquery.query.BaseQuery._request')
Expand Down Expand Up @@ -172,7 +174,8 @@ def parse_coordinates(coordinates):
"appropriate astropy.coordinates object.", InputWarning)
raise u.UnitsError
except ValueError as err:
if isinstance(err.args[1], u.UnitsError):
if ((ASTROPY_LT_5_0 and isinstance(err.args[1], u.UnitsError)) or
(not ASTROPY_LT_5_0 and isinstance(err.__context__, u.UnitsError))):
try:
c = ICRSCoordGenerator(coordinates, unit='deg')
warnings.warn("Coordinate string is being interpreted as an "
Expand Down