-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Pygame pollutes stdio with spammy message #985
Comments
I became so enamoured with this idea, I have made it its own package: https://github.com/Julian-O/pygamesilent Hasn't hit PyPi yet. |
You can just put: os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" Before importing |
Yes, you can do that. With sufficient commenting to explain the intent of this magic incantation, and repeated in every location that pygame is imported. I have gone with a shim based on DRY principles. |
I'd agree with @Oj18, which is just a one-liner inside |
I am not going to the mat on this one, but it is at least three lines repeated identically in three files. |
#1017 has been merged 👍🏼 |
Unfortunately, the maintainer of the PyGame repository has decided to add a spammy message that gets printed to stdio the first time
pygame
is imported. Complaints about it have been dismissed with feeble justifications.MoviePy will import pygame if it is installed, meaning command-line MoviePy applications will start up with an unrelated message about PyGame, which is likely to confuse most users.
Fortunately, a workaround has now been included:
If the
PYGAME_HIDE_SUPPORT_PROMPT
environment variable is present, the message is not displayed.Asking direct clients to create this variable before importing pygame is onerous, but expecting a client of MoviePy to understand what they need to do to suppress it is worse.
Therefore, I recommend that in each of the places that PyGame is imported, the environment variable be set first.
(Perhaps a single shim file that does this work-around and imports PyGame in one place would be better. Then the shim could be imported instead of pygame in each location.)
Expected Behavior
Actual Behavior
Steps to Reproduce the Problem
Install
pygame>=1.9.5
andmoviepy
, and runimport moviepy.editor
for example.The text was updated successfully, but these errors were encountered: