Not tested, but try getting a file object and using that instead, e.g. f=open('myfile.wav') pygame.mixer.music.load(f) ... pygame.mixer.music.stop() f.close()
Russell On 21 March 2012 01:13, kfank <kurtbutfr...@gmail.com> wrote: > I'm using pygame to play a wav file using the mixer.music module, but > after completion the file remains locked. For example, > > import pygame > pygame.mixer.init(44100, -16, 2, 1024) > clock = pygame.time.Clock() > pygame.mixer.music.load('myfile.wav') > pygame.mixer.music.play(1) > ... > # wait until completion > ... > pygame.mixer.music.stop() > > At this point the file is still locked by the process. How do you close > the file handle which was opened by the load command? > >