[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] diff betn interactive and non-interactive scripts



On Wednesday 10 April 2002 02:29 am, Prahlad Vaidyanathan wrote:
> Hi,
>
> I just started playing around with the pygame.mixer module, and found
> this quirk. In the interactive session, the following works (ie. it
> playes the wav file) :
>
> """
> $ python
> Python 2.2 (#2, Feb 25 2002, 20:10:48)
> [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
> Type "help", "copyright", "credits" or "license" for more
> information.
>
> >>> import pygame.mixer
> >>> pygame.mixer.init()
> >>> sf = pygame.mixer.Sound('test/test.wav')
> >>> sf.play()
>
> <Channel object at 0x814f798>
>
> """
>
> But, if I put these exact same lines into a script and run it from the
> same python interpreter (2.2), it does not play it.
>
> """
> $ python test.py
> $ cat test.py
> import pygame.mixer
> pygame.mixer.init()
> sf = pygame.mixer.Sound('test/test.wav')
> sf.play()
> """

try putting a "while 1: pass" or "time.sleep(100)" at the end of the script - 
it looks to my eye (which is almost totally ignorant of how all this works, 
so is just guessing ;) like the program is exiting before the mixer can 
actually play anything...


    Richard

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org