OS X: How to play .wav file w/Python?

alex23 wuwei23 at gmail.com
Tue May 12 04:47:29 CEST 2009


On May 12, 11:55 am, kj <so... at 987jk.com.invalid> wrote:
> import pygame.mixer
>
> pygame.mixer.init()
> pygame.mixer.Sound("bell.wav").play
> print "done"
>
> What am I doing wrong?

Your first mistake is not pasting here the traceback you received.
That always makes it easier to assist with problems like this.

However, my guess is it's this line:

> pygame.mixer.Sound("bell.wav").play

'play' is a method, which means you need to call it. Try the following
instead:

> pygame.mixer.Sound("bell.wav").play()

And let us know how that goes :)



More information about the Python-list mailing list