[Python-apps-team] Bug#606993: Bug#606993: subdownloader: always fail to download selected subs

Sandro Tosi morph at debian.org
Sat Dec 25 14:10:28 UTC 2010


Hi all,

On Mon, Dec 13, 2010 at 20:17, florian <fgruel at hotmail.com> wrote:
> Package: subdownloader
> Version: 2.0.14-1
> Severity: grave
> Justification: renders package unusable
>
>
> When launched from commandline, this message appears for all selected subtitle
>
> Traceback (most recent call last):
>  File "/usr/share/subdownloader/gui/main.py", line 1043, in onButtonDownload
>    destinationPath = self.getDownloadPath(sub.getVideo(), sub)
>  File "/usr/share/subdownloader/gui/main.py", line 1012, in getDownloadPath
>    downloadFullPath = os.path.join(folderPath, subFileName).decode('utf8')
>  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'\xe9' in position 13: ordinal not in range(128)

the problem is easily replicable with:

$ python -c "import os.path ; print os.path.join('/tmp/',
u'\xe9').decode('utf8')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  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'\xe9' in
position 5: ordinal not in range(128)

That's because one of the 2 parameters is already encoded (the '/tmp/'
one, which is a string) while the other is unicode. The solution here
is either make both params a string, and then decode after the join()
or just remove the ".decode('utf8')":

$ python -c "import os.path ; print os.path.join('/tmp/', u'\xe9')"
/tmp/é

since join() returns a unicode object in that case.

What do the subdownloader developers think about it?

Even if the bug is annoying, I don't think it deserves an RC severity
in Debian: anynow against downgrading it to important?

Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi





More information about the Python-apps-team mailing list