View Full Version : [Question(s)] Pygame Joystick Disable Console Output

05-10-2011, 06:58 PM
I am reading joystick data from my xbox 360 controller in pygame and found an annoying glitch. Every time I use the j.get_axis(0) command it prints a fancy string to the console with the value. This would be OK but I need to be able to see error messages and other important data.

I researched it for a long time finally coming across this thread:


However they only point out the problem never how to fix it.

I tried to suppress the console out put with commands like

sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
sys.__stdout__ = open(os.devnull, 'w')
sys.__stderr__ = open(os.devnull, 'w')
sys.stdin = open(os.devnull, 'w')

but the annoying string continues to print! Finally I went into the source code and made changes deleting the printf command but was unable to compile it because I'm a noob.

I know there are a lot of pygame experts here so I was hoping somebody could shed some light on how to get pygame to stop printing this message.

For reference I am using pygame-1.9.1 on windows 7 x64.