wackou/guessit — pull request #50 by Toilal (2013-10-31 09:44:36+00:00)
Title: Workaround for http://bugs.python.org/issue2128

There is bug in python 2.x on windows. sys.argv on windows can't retrieve unicode strings (see http://bugs.python.org/issue2128).

D:\devel\workspace\guessit>python -m guessit "é.avi"
Traceback (most recent call last):
File "D:\Python\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "D:\Python\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\devel\workspace\guessit\guessit\__main__.py", line 115, in
main()
File "D:\devel\workspace\guessit\guessit\__main__.py", line 109, in main
info = options.info.split(','))
File "D:\devel\workspace\guessit\guessit\__main__.py", line 30, in detect_filename
filename = u(filename)
File "guessit\__init__.py", line 56, in u
return x.decode('utf-8')
File "D:\Python\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 0: invalid continuation byte

After the fix

D:\devel\workspace\guessit>python -m guessit "é.avi"
For: é.avi
GuessIt found: {
[1.00] "mimetype": "video/x-msvideo",
[1.00] "type": "movie",
[1.00] "container": "avi",
[0.60] "title": "\u00e9"
}