Skip to content
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

Optional Gaia server messages? #3196

Open
robertdstein opened this issue Jan 31, 2025 · 0 comments
Open

Optional Gaia server messages? #3196

robertdstein opened this issue Jan 31, 2025 · 0 comments

Comments

@robertdstein
Copy link
Contributor

Right now I am using astroquery as a dependency for a package, and have doc tests that involve my module. These occasionally break, because of gaia status messages which get printed directly to stdout.

def get_status_messages(self):

That's fair enough, I think most users might want to see these messages by default. However, I would personally like to switch them off. So I try using the kwarg argument to switch them off:

from astroquery.gaia import GaiaClass
Gaia = GaiaClass(show_server_messages=False)

which makes use of:

if show_server_messages:

In theory that should work, but right at the bottom of the script defining the GaiaClass class, there is this line:

Gaia = GaiaClass()

That creates a GaiaClass object, and uses the default settings (i.e show_server_message=True). So, by time I've hit the line from astroquery.gaia import GaiaClass I already get the stdout message.

As a workaround I can send things to dev null for that one specific import line, but it seems to me like the show_server_message argument is not behaving as intended, so I thought I would create the github issue here first.

Options I can think of to fix this include be to using the python logger rather than print (then I can toggle the message on/off), have the default of the printing set by an environment level, or setting a default of show_server_message=False. Apologies if a discussion about this already exists.

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

No branches or pull requests

1 participant