you should learn about codecs strings inputs/output. ensure you always work with the same, utf8. most of python modules are based on, and python3 assume by default as in python2 you got
from __future__ import unicode_literals see (in french, sorry) a good link: http://sametmax.com/lencoding-en-python-une-bonne-fois-pour-toute/ 2015-02-14 11:21 GMT+01:00 Bo Jangeborg <b...@softwave.se>: > 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. >