[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Problem copying then playing a wav file



Thanks, I just os.path.join'd a bunch of code. And looking at the code
after doing that I realized I needed to close the file:

        fd, filename = tempfile.mkstemp(".wav", "myaudio_", dirname)
        os.close(fd)

It wasn't obvious from the example code I copied that I needed to do
this, but this fixed it.

Mark


On Thu, May 5, 2011 at 10:06 AM, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
> Mark Reed wrote:
>
>>        self.snd = pygame.mixer.Sound(dirname+filename)
>
>                                        ^^^^^^^^^^^^^^^^
>
> Are you sure that dirname has a trailing path separator
> at this point?
>
> It might be safer to use os.path.join() here.
>
> --
> Greg
>