AcezJensen
Posts: 2
Joined: Thu Feb 13, 2020 1:34 am

Button pressed = .wav played

Thu Feb 13, 2020 1:44 am

I was following the Raspberry Pi tutorial for the Music box: https://projects.raspberrypi.org/en/pro ... usic-box/3
Along the way I went through the steps shown and got it to work, until it came to playing the .wav file. When it came time for that I coded it in Python like the instructor did in the video, but when I went to go press the button this is what error it gave me:

pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/home/pi/ISAC Noisemaker/ISAC Noisemaker.py", line 4, in <module>
pygame.int()
AttributeError: Module 'pygame' has no attribute 'int'

I am extremely green (new) when it comes to coding, raspberry pi's, and the such, so if anyone could help me that would be great.

If anyone does try to help me with this, I apologize in advance for my slow responses because I am a student and I have a never ending stream of projects and assignments due.

User avatar
topguy
Posts: 6527
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Button pressed = .wav played

Thu Feb 13, 2020 10:15 am

Code: Select all

pygame.int()
AttributeError: Module 'pygame' has no attribute 'int'
Did you mean to write "init" and not "int" maybe ?

https://www.pygame.org/docs/ref/pygame.html#pygame.init

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Button pressed = .wav played

Thu Feb 13, 2020 10:28 am

As already pointed out..

Just look again at the first block of code on the tutorial page you linked, under the line "First, import and initialise the pygame module for playing sound files"

AcezJensen
Posts: 2
Joined: Thu Feb 13, 2020 1:34 am

Re: Button pressed = .wav played

Thu Feb 13, 2020 4:25 pm

topguy wrote:
Thu Feb 13, 2020 10:15 am

Code: Select all

pygame.int()
AttributeError: Module 'pygame' has no attribute 'int'
Did you mean to write "init" and not "int" maybe ?

https://www.pygame.org/docs/ref/pygame.html#pygame.init
And now after I have been banging my head against a wall all night trying to figure out what was wrong, and I realize it was just one character that I neglected to put in. Thank you for the help!

Return to “Python”