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

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



Bo,

i just forgot one last think in my copy/paste code.
last but not least, otherwise it effectively don't work.

from codecs import open

are you sure that file is compliant?
i'd test my code on linux and win7, both work well with same code and same ogg file.
and i have sames errors as youres if other.
you can't pygame.mixer.music.load(file_path) directly you have to
pygame.mixer.music.load(open(file_path)) as greg said.

use Audacity http://audacity.sourceforge.net/ , and re convert to complaint ogg file if necessary.
that should be enought, but you also have to manage this kind error in your software.


2015-02-14 12:50 GMT+01:00 Bo Jangeborg <bo@xxxxxxxxxxx>:
Greg Ewing skrev den 2015-02-14 12:46:

Bo Jangeborg wrote:

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.

I think it means a file object, not the file contents:

 file_path = "07-Boabdil, BulerÃas.ogg"
 fi = open(file_path, 'rb')
 pygame.mixer.music.load(fi)

If open() is able to handle the unicode file
name, that ought to work.

the open() command by it self works, so
python can handle the unicode string,
but the following doesn't work.


 file_path = "07-Boabdil, BulerÃas.ogg"
 pygame.mixer.music.load(file_path)