2013-03-15, 17:21
I see what is going on here. I have the same problem on my OpenElec box. Either we've encountered a python bug or I understand nothing.
The python docs clearly states http://docs.python.org/2/howto/unicode.html
However:
Ways to get around it: rollback to v0.7.2 or get rid of non-ascii character in filenames, or change locale to UTF-8 (OpenElec uses posix. Yes, I know, wtf.)
The python docs clearly states http://docs.python.org/2/howto/unicode.html
Quote:Functions in the os module such as os.stat() will also accept Unicode filenames.
However:
Code:
>>> for _ in os.listdir(u'/storage/videos/Profeten.2009.720p.Bluray.x264-H@M'):
... print _
...
Un prophète 2009 720p Bluray x264 H@M_en.srt
Un prophète 2009 720p Bluray x264 [email protected]
Code:
>>> for _ in os.walk('/storage/videos/Profeten.2009.720p.Bluray.x264-H@M'):
... print _
...
('/storage/videos/Profeten.2009.720p.Bluray.x264-H@M', [], ['Un proph\xc3\xa8te 2009 720p Bluray x264 H@M_en.srt', 'Un proph\xc3\xa8te 2009 720p Bluray x264 [email protected]'])
Code:
>>> for _ in os.walk(u'/storage/videos/Profeten.2009.720p.Bluray.x264-H@M'):
... print _
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./Lib/os.py", line 284, in walk
File "./Lib/posixpath.py", line 71, in join
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)
Ways to get around it: rollback to v0.7.2 or get rid of non-ascii character in filenames, or change locale to UTF-8 (OpenElec uses posix. Yes, I know, wtf.)