diff --git a/gymnasium/__init__.py b/gymnasium/__init__.py index d7d280a08..a4c281ef7 100644 --- a/gymnasium/__init__.py +++ b/gymnasium/__init__.py @@ -21,6 +21,19 @@ register_envs, ) +# Initializing pygame initializes audio connections through SDL. SDL uses alsa by default on all Linux systems +# SDL connecting to alsa frequently create these giant lists of warnings every time you import an environment using +# pygame +# DSP is far more benign (and should probably be the default in SDL anyways) + +import os +import sys + +if sys.platform.startswith("linux"): + os.environ["SDL_AUDIODRIVER"] = "dsp" + +os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "hide" + # necessary for `envs.__init__` which registers all gymnasium environments and loads plugins from gymnasium import envs from gymnasium import spaces, utils, vector, wrappers, error, logger, functional @@ -55,20 +68,6 @@ ] __version__ = "1.0.0a2" - -# Initializing pygame initializes audio connections through SDL. SDL uses alsa by default on all Linux systems -# SDL connecting to alsa frequently create these giant lists of warnings every time you import an environment using -# pygame -# DSP is far more benign (and should probably be the default in SDL anyways) - -import os -import sys - -if sys.platform.startswith("linux"): - os.environ["SDL_AUDIODRIVER"] = "dsp" - -os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "hide" - try: from farama_notifications import notifications