Re: weird behaviour: pygame plays in shell but not in script

2012-04-02 Thread Mik

I can't believe I am so dumb!

after sound.play() the script was terminating
I didn't notice that 'play()' actually returns...

What a nice way to introduce myself to the group!!! :-)

sorry for bothering you guys :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


weird behaviour: pygame plays in shell but not in script

2012-04-02 Thread Mik
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()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: weird behaviour: pygame plays in shell but not in script

2012-04-02 Thread Mik
Oh thanks alex!
that's kind!

PS: It looks like a party indeed: plenty of interesting
discussions :-)

On Mar 30, 4:33 am, alex23  wrote:
> On Mar 29, 10:41 pm, Mik  wrote:
>
> > What a nice way to introduce myself to the group!!! :-)
>
> Hey, don't beat yourself up, you:
>
>  - summarised the problem in the subject heading
>  - included actual code showing the problem
>  - reported back on the problem you found
>
> That puts you ahead of most new posters.
>
> > sorry for bothering you guys :-)
>
> No bother at all, welcome to the party :)

-- 
http://mail.python.org/mailman/listinfo/python-list