How do I delete the "Hello from the pygame community" console alert while using pygame?
Question:
Every time I run my python game, I get an annoying alert in the console saying:
Hello from the pygame community. https://www.pygame.org/contribute.html
How do I delete this?
Answers:
Mac OS
- Navigate to:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygame/
and open _init_.py
(hint: this is the Library for your Macintosh HD, not your users library)
- scroll down to the bottom of the page, then delete the line saying:
print('Hello from the pygame community ... )
If you can’t find your Library folder, then you probably still have the default settings set to hide it.
-
type defaults write com.apple.finder AppleShowAllFiles YES;
in the terminal
-
hold option + right click on finder and click relaunch.
Windows
(this is untested, if you have problems let me know so I can update)
- Navigate to:
C:PythonLibsite-packagespygame
and open _init_.py
- scroll down to the bottom of the page, then delete the line saying:
print('Hello from the pygame community ... )
Modifying the library would mean that you would have to modify the library everywhere you ship your code, and is generally not a good idea.
The upcoming release 1.9.5
of pygame will include an option to turn off the message without modifying the library:
You have to set the environment variable PYGAME_HIDE_SUPPORT_PROMPT
to any value.
On Windows: set PYGAME_HIDE_SUPPORT_PROMPT=1
On Linux etc.: export PYGAME_HIDE_SUPPORT_PROMPT=1
Or even in your code:
from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame # it is important to import pygame after that
Every time I run my python game, I get an annoying alert in the console saying:
Hello from the pygame community. https://www.pygame.org/contribute.html
How do I delete this?
Mac OS
- Navigate to:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygame/
and open_init_.py
(hint: this is the Library for your Macintosh HD, not your users library)
- scroll down to the bottom of the page, then delete the line saying:
print('Hello from the pygame community ... )
If you can’t find your Library folder, then you probably still have the default settings set to hide it.
-
type
defaults write com.apple.finder AppleShowAllFiles YES;
in the terminal -
hold option + right click on finder and click relaunch.
Windows
(this is untested, if you have problems let me know so I can update)
- Navigate to:
C:PythonLibsite-packagespygame
and open_init_.py
- scroll down to the bottom of the page, then delete the line saying:
print('Hello from the pygame community ... )
Modifying the library would mean that you would have to modify the library everywhere you ship your code, and is generally not a good idea.
The upcoming release 1.9.5
of pygame will include an option to turn off the message without modifying the library:
You have to set the environment variable PYGAME_HIDE_SUPPORT_PROMPT
to any value.
On Windows: set PYGAME_HIDE_SUPPORT_PROMPT=1
On Linux etc.: export PYGAME_HIDE_SUPPORT_PROMPT=1
Or even in your code:
from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame # it is important to import pygame after that