weird behaviour: pygame plays in shell but not in script
Mik
mikprog at gmail.com
Thu Mar 29 08:33:45 EDT 2012
Dear all,
I am a bit frustrated by the following as I believe it is something
silly that I am not able to see.
I am using python 2.7.1+ under ubuntu.
When I run the following script as in
$python script.py
I do not get any sound out of it
BUT if I run every line in the python shell it works great.
It doesn't make sense to me, maybe someone has a clue?
Thanks for any clue!
Mik
import pygame
#done twice to get rid of a sound card error
pygame.mixer.init()
pygame.mixer.init()
pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.init()
# called twice to make it so that it detects sound card
pygame.init()
print "init"
sounds = []
sounds.append(pygame.mixer.Sound("../audio/song01.wav"))
sounds.append(pygame.mixer.Sound("../audio/song02.wav"))
sounds.append(pygame.mixer.Sound("../audio/song03.wav"))
sounds.append(pygame.mixer.Sound("../audio/song04.wav"))
for sound in sounds:
print ".."
sound.play()
More information about the Python-list
mailing list