Skip to content

Simbad query and query_id fail #2244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tonione opened this issue Dec 8, 2021 · 11 comments
Closed

Simbad query and query_id fail #2244

Tonione opened this issue Dec 8, 2021 · 11 comments

Comments

@Tonione
Copy link

Tonione commented Dec 8, 2021

I have encountered trouble with simple Simbad queries. I'm on python3.8 on mac OS, with astropy (5.0) and astroquery (0.4.4).

Simple queries such as
from astroquery.simbad import Simbad obj=Simbad.query_object('Kepler-235')
or
from astroquery.simbad import Simbad name=Simbad.query_objectids('Kepler-235')
result both in the same error:
/opt/anaconda3/lib/python3.8/site-packages/astroquery/simbad/core.py:135: UserWarning: Warning: The script line number 3 raised an error (recorded in the errors attribute of the result table): java.lang.NullPointerException

Did anyone encounter the same issue? I

@keflavich
Copy link
Contributor

I can't reproduce this error. It may have been a temporary service issue. Please try again. If it persists, try querying with the cache disabled:

from astroquery.simbad import Simbad
obj=Simbad.query_object('Kepler-235', cache=False)

If that works (and querying with cache enabled does not), you will need to clear your cache.

@Tonione
Copy link
Author

Tonione commented Dec 8, 2021

Hi, thank you so much for taking the time to look into it. I have no optional argument 'cache' in Simbad.query_object so I cannot check it out. How would proceed to clear the cache otherwise? Thanks again.

keflavich added a commit to keflavich/astroquery that referenced this issue Dec 8, 2021
(this was prompted by astropy#2244, which revealed that query_X was not passing
kwargs to query_X_async, including the cache argument)
@keflavich
Copy link
Contributor

Remove files in your ~/.astropy/cache/astroquery/Simbad/ directory.

This conversation has revealed a bug, though: simbad.query_object() should pass the cache argument on, but it does not.

@Tonione
Copy link
Author

Tonione commented Dec 8, 2021

Removing cache files worked like a charm, thank you so much!

@aoberto
Copy link
Contributor

aoberto commented Dec 9, 2021

Hello, do you think that we could have a maximum duration for the cache ? For instance, like 1 day ?

@aframosp
Copy link

aframosp commented Dec 9, 2021

I have the same issue as described by @Tonione, this time for simbad.query_objects(). Removing the cache directory helps only momentarily, because the error is happening every ~10 min if I try some queries continiously.

@keflavich
Copy link
Contributor

@aoberto cache expiration has been a wishlist item for a while.

However, the problem reported here seems to be a real one involving caching failed queries; we should never cache failed queries.

@aoberto
Copy link
Contributor

aoberto commented Dec 9, 2021

@aframosp Ho yes, I found the origin of the NullPointer, and fix it (I hope) at least it should avoid the wrong behavior, sorry for that.
@keflavich Yes, of course, this is better, but I do not know which one is easier to do

@keflavich
Copy link
Contributor

Not caching failures is both a bit easier and more critical. Even though the upstream part of this issue is solved, I'd like to leave it open until I fix the caching issue.

@keflavich
Copy link
Contributor

#2187 was the solution to this issue. I'm not entirely sure, but this issues may be solved already. Without a clearer MWE (which is hard to make, since the issue is fundamentally upstream), it is hard to test.

@aoberto is there a query we could run against SIMBAD that would reliably fail with exactly this error so we can add a test of how astroquery handles the error?

@bsipocz
Copy link
Member

bsipocz commented Dec 9, 2021

cache timeout has been worked on and we have two abandoned WIP PRs for some fixes. Maybe they can be warmed up and wrapped up?

@ceb8 - would you think #1634 need much more work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants