Greg Ewing skrev den 2015-02-14 02:00:
Bo Jangeborg wrote:file_path = "07-Boabdil, Bulerías.ogg" fi = open(file_path, 'rb').read() pygame.mixer.music.load(fi) But that gets me the Error: "File path 'OggS' contains null characters"music.load() expects to be passed the name of a file, not the contents of the file. Just do this: file_path = "07-Boabdil, Bulerías.ogg" pygame.mixer.music.load(file_path)
The reason I tried the object passing was because just passing the name didn't work. So I am looking for a workaround. According to the documentation one should be able to pass an object as a parameter but I am not sure if I am doing it the right way. pygame.mixer.music.load() Load a music file for playback load(filename) -> None load(object) -> None This will load a music filename/file object and prepare it for playback.