Skip to content

Handling No astronomical object found response #3060

Description

@lmichel

When I run the following script that queries a tiny sky region where Simbad has no object:

from astroquery.simbad import Simbad
from astropy.coordinates import SkyCoord, search_around_sky, Angle
import astropy.units as u

ra = 0
dec = -90
output_table= Simbad.query_region(SkyCoord(ra, dec,unit=(u.deg, u.deg), frame='icrs'), radius=0.01*u.arcsec)

This code raises the following warning:

WARNING: BlankResponseWarning: Warning: The script line number 3 raised an error (recorded in the `errors` attribute of the result table): '0:00:00 -90:00:00': No astronomical object found : [astroquery.simbad.core]

The problem is that output_table is None.
There is no way to grab by software the reason of the failure except by parsing the WARNING message (awkward/ugly).

There are 2 options to improve this issue:

  • The query region could return a tuple such as e.g. (error_status, table)
  • The method should be refactored in order to return a VOTable in any case (as announced by the warning)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions