Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if filename contains umlauts #17

Closed
kTitan opened this issue Jan 5, 2011 · 7 comments
Closed

Error if filename contains umlauts #17

kTitan opened this issue Jan 5, 2011 · 7 comments

Comments

@kTitan
Copy link

kTitan commented Jan 5, 2011

I have always this problem if I try to run tvnamer on a file which contain german umlauts in it.

%% tvnamer testserieswithä_s01e01.avi
Loading config: /root/.tvnamer.json
####################
# Starting tvnamer
# Found 1 episode
####################
Traceback (most recent call last):
  File "/usr/bin/tvnamer-2.6", line 9, in 
    load_entry_point('tvnamer==2.1', 'console_scripts', 'tvnamer')()
  File "/usr/lib64/python2.6/site-packages/tvnamer/main.py", line 351, in main
    tvnamer(paths = sorted(args))
  File "/usr/lib64/python2.6/site-packages/tvnamer/main.py", line 268, in tvnamer
    processFile(tvdb_instance, episode)
  File "/usr/lib64/python2.6/site-packages/tvnamer/main.py", line 112, in processFile
    p("# Processing file: %s" % episode.fullfilename)
  File "/usr/lib64/python2.6/site-packages/tvnamer/utils.py", line 518, in fullfilename
    return u"%s.%s" % (self.filename, self.extension)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)

Currently I am using tvnamer version 2.1 with python 2.6

@dbr
Copy link
Owner

dbr commented Jan 23, 2011

Could you try with the latest git version? Don't seem to have the same error with it:

$ tvnamer testserieswithä_s01e01.avi 
####################
# Starting tvnamer
# Found 1 episode
####################
# Processing file: testserieswithä_s01e01.avi
[...]

@kTitan
Copy link
Author

kTitan commented Jan 23, 2011

updated to commit: e96a5ea
and tried it. Same error :(

%% tvnamer testserieswithä_s01e01.avi
Loading config: /root/.tvnamer.json
####################
# Starting tvnamer
# Found 1 episode
####################
Traceback (most recent call last):
  File "/usr/bin/tvnamer-2.6", line 9, in 
    load_entry_point('tvnamer==2.1', 'console_scripts', 'tvnamer')()
  File "/usr/lib64/python2.6/site-packages/tvnamer/main.py", line 363, in main
    tvnamer(paths = sorted(args))
  File "/usr/lib64/python2.6/site-packages/tvnamer/main.py", line 280, in tvnamer
    processFile(tvdb_instance, episode)
  File "/usr/lib64/python2.6/site-packages/tvnamer/main.py", line 125, in processFile
    p("# Processing file: %s" % episode.fullfilename)
  File "/usr/lib64/python2.6/site-packages/tvnamer/utils.py", line 447, in fullfilename
    return u"%s.%s" % (self.filename, self.extension)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)

@dbr
Copy link
Owner

dbr commented Jan 30, 2011

Strange. Not sure what the code could be doing wrong to cause this..

Could you try doing:

$ touch "testserieswithä_s01e01.avi"
$ python
>>> import os
>>> os.listdir(u".")
[u'testserieswitha\u0308_s01e01.avi']

..and comment the last line here?

Also, what terminal emulator and filesytem are you using?

@kTitan
Copy link
Author

kTitan commented Jan 30, 2011

Here is the wished output:

>>> os.listdir(u".")
[u'testserieswith\xe4_s01e01.avi']

I am using a ext4 filesystem and most time I access it with putty.
But if I remember it correctly it also happens if i use a gnome terminal.

@kTitan
Copy link
Author

kTitan commented Feb 2, 2011

Ok a new info.

It look like the issue 22 here on github is a dupe of my problem.

I tried what Antoniogra7 did and deleted my .tvnamer.json file.
Then it worked without any problems.

Then i created a new empty file

{
}

and the error is here again.
No matter what config options i put in, the error always comes again.

@dbr
Copy link
Owner

dbr commented Feb 3, 2011

That is bizarre.

I can reproduce the problem here - as soon as a config is specified (or picked up automatically, that error occurs.

@dbr dbr closed this as completed in 8b63369 May 21, 2011
@dbr
Copy link
Owner

dbr commented May 21, 2011

Aha! Problem was disappointingly simple...

I was doing [x.decode(...) for x in args] when first parsing the arguments, but when a config is loaded, the arguments are re-parsed (with the config values as the new defaults), and these args were never decoded, thus the error

Just pushed change for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants