astropy / astroquery

Functions and classes to access online data resources. Maintainers: @keflavich and @bsipocz and @ceb8
http://astroquery.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
706 stars 398 forks source link

"No table found in VOTABLE file" for Simbad MAIN_ID #1232

Closed Roman-UCLU closed 6 years ago

Roman-UCLU commented 6 years ago

I spent quite a while trying to figure this out; all in vain. Below is the code of the simplest possible Simbad query:

from astroquery.simbad import Simbad
result_table = Simbad.query_object("QSO B0003-066")
print(result_table)

Here "QSO B0003-066" is, actually, the main Simbad ID of the object (online). The result is the error in the issue title.

Surprisingly, when querying any of the alternative IDs (e.g. "AT20G J000613-062334"), the query works just fine.

Is there something obvious I'm missing?

Thanks!

bsipocz commented 6 years ago

What version of astroquery do you use? It works for me as expected:

In [88]: from astroquery.simbad import Simbad
    ...: result_table = Simbad.query_object("QSO B0003-066")
    ...: print(result_table)
    ...: 
    ...: 
   MAIN_ID          RA      ... COO_WAVELENGTH     COO_BIBCODE    
                 "h:m:s"    ...                                   
------------- ------------- ... -------------- -------------------
QSO B0003-066 00 06 13.8928 ...              R 2009A&A...493..317L
Roman-UCLU commented 6 years ago

Thanks, Brigitta!

My version is 0.3.7...

This is really strange. Any possible reason why it may not be working for me? Here's the full output:

C:\Program Files\Python\lib\site-packages\astroquery\simbad\core.py:136: UserWarning: Warning: The script line number 2 raised an error (recorded in the `errors` attribute of the result table): java.lang.NullPointerException
  (error.line, error.msg))
---------------------------------------------------------------------------
TableParseError                           Traceback (most recent call last)
<ipython-input-1-bfc36190b472> in <module>()
      1 from astroquery.simbad import Simbad
----> 2 result_table = Simbad.query_object("QSO B0003-066")
      3 print(result_table)

C:\Program Files\Python\lib\site-packages\astroquery\simbad\core.pyc in query_object(self, object_name, wildcard, verbose, get_query_payload)
    507 
    508         return self._parse_result(response, SimbadVOTableResult,
--> 509                                   verbose=verbose)
    510 
    511     def query_object_async(self, object_name, wildcard=False, cache=True,

C:\Program Files\Python\lib\site-packages\astroquery\simbad\core.pyc in _parse_result(self, result, resultclass, verbose)
   1017                                   " parsed result is in "
   1018                                   "self.last_parsed_result.\n "
-> 1019                                   "Exception: " + str(ex))
   1020         resulttable.errors = self.last_parsed_result.errors
   1021         return resulttable

TableParseError: Failed to parse SIMBAD result! The raw response can be found in self.last_response, and the error in self.last_table_parse_error. The attempted parsed result is in self.last_parsed_result.
 Exception: No table found in VOTABLE file.
bsipocz commented 6 years ago

Weird. There were some recent changes since 0.3.7 in the module, but even with that version the snippet works for me.

Could you check whether the payload and the url is same for you:

In [5]: Simbad.query_object("QSO B0003-066", get_query_payload=True)
Out[5]: {'script': '\nvotable {main_id,coordinates}\nvotable open\nquery id  QSO B0003-066  \nvotable close'}

In [6]: Simbad.SIMBAD_URL
Out[6]: 'http://simbad.u-strasbg.fr/simbad/sim-script'

also, could you print out Simbad.last_response.content and Simbad.last_table_parse_error after the query produced the failure?

aoberto commented 6 years ago

I assume that it was the same issue than #1232 : a temporary problem in Simbad. It was resolved few hours ago, may be there is some cache ?

bsipocz commented 6 years ago

@Roman-UCLU - please try to clear the cache, Simbad.cache_location tells you the location.

Roman-UCLU commented 6 years ago

Sorry for the delay.

Indeed, this was a caching issue. I deleted everything from the directory returned by Simbad.cache_location and that cut it!

Thank you so much, everyone!

Negar3362 commented 1 year ago

Hello, I'm having the same problem with Ned query even after clearing the cache. Using different astropy and astroquery versions, I am still facing the same issue. Are there any solutions to this problem? Thanks.

Here is The code and error:

from astroquery.ipac.ned import Ned result_table = Ned.query_object('NGC 224')

IndexError: No table found in VOTABLE file.

keflavich commented 1 year ago

@Negar3362 what versions of astropy & astroquery are you using? With astropy, astroquery = ('5.1', '0.4.7.dev8846'), I don't see this issue.

Negar3362 commented 1 year ago

@keflavich The version of Astroquery I'm using is 0.4.6. I'll try 0.4.7 as well. Thanks.