-
-
Notifications
You must be signed in to change notification settings - Fork 423
Description
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.
astroquery/astroquery/gaia/core.py
Line 1025 in ade38dc
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:
astroquery/astroquery/gaia/core.py
Line 89 in ade38dc
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:
astroquery/astroquery/gaia/core.py
Line 1048 in ade38dc
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.