If I change the single letter that is outside of the ascii range the file loads perfectly. os.exists(file_path) evaluates as true even with the special character so there is nothing wrong with the file_path.
Gino Ingras skrev den 2015-02-14 02:13:
do you had try file_path.replace(' ', '\\ ') ?2015-02-14 1:23 GMT+01:00 Bo Jangeborg <[email protected] <mailto:[email protected]>>:I am trying to open an ogg file with: file_path = "07-Boabdil, BulerĂas.ogg" pygame.mixer.music.load(file_path) But I get an Error message saying that one of the unicode characters are out of range and can not be encoded. If I remove the offending character the file loads fine so I assume the problem is that only ascii is accepted. Since os.exists(file_path) evaluates as true I tried using the following: 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" Am I doing something wrong or is there no way to open a soundfile with non ascii characters ? I am running pygame on Windows 7. Bo Jangeborg
