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

Re: [pygame] pyg_mixer.music.load doesn't take non ascii chars



assume in line 2:
# -*- coding: utf8 -*-
...
from codecs import open
...
#don't know if your file_path is hard coded, if not you may
file_path = file_path.decode('utf8')
...
#and then, as Greg told:
pygame.mixer.music.load(open(file_path))

work fine on win7 and linux(Mint17)


2015-02-14 2:00 GMT+01:00 Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx>:
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)

--
Greg