dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
912 stars 115 forks source link

Fails to parse names with special characters #16

Closed ghost closed 13 years ago

ghost commented 13 years ago

Just tried sorting my Alias folder, but 1x05, 3x15 and 4x07 make the script fail due to the characters ä, ç and é in the source filenames, returning the error below:

Loading config: /home/peter/.tvnamer.json
/usr/local/lib/python2.6/dist-packages/tvnamer-2.0-py2.6.egg/tvnamer/main.py:233: UserWarning: The move_files feature is still under development. Be very careful with it.
It has not been heavily tested, and is not recommended for general use yet.
  warnings.warn("The move_files feature is still under development. "
####################
# Starting tvnamer
Traceback (most recent call last):
  File "/usr/local/bin/tvnamer", line 9, in <module>
    load_entry_point('tvnamer==2.0', 'console_scripts', 'tvnamer')()
  File "/usr/local/lib/python2.6/dist-packages/tvnamer-2.0-py2.6.egg/tvnamer/main.py", line 348, in main
    tvnamer(paths = sorted(args))
  File "/usr/local/lib/python2.6/dist-packages/tvnamer-2.0-py2.6.egg/tvnamer/main.py", line 244, in tvnamer
    cfile = cfile.decode("utf-8")
  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 38: ordinal not in range(128)

The same happens with file moving disabled. Replacing these characters makes everything work as expected.

dbr commented 13 years ago

I think you are using an old version of tvnamer? The line that is causing the problem (cfile.decode(...)) no longer exists in the current version

I need to update the version of tvnamer on PyPi - will do this shortly - in the mean time, you could install tvnamer from source - the instructions are in the readme: https://github.com/dbr/tvnamer

dbr commented 13 years ago

Latest version (2.1) is now in PyPi:

easy_install tvnamer==2.1

or

pip install tvnamer==2.1

..should do it - reopen if this is still a problem!

ghost commented 13 years ago

You're quite right, I was using the old version straight from easy_install. Just installed the latest version from git and it's working beautifully.