RedRise/lm

Special chars and --download

Closed this issue · 6 comments

Hi

There is an issue with special chars in the path when you download subtitles.

$ ./lm.py ~/Vidéos/ --download eng

2012-02-28 00:28:25,082: LM - ERROR - this path doesnt belong to cash_path /home/matthieu/Vidéos/Phy432_amphi_7.mkv
Traceback (most recent call last):
  File "./lm.py", line 1436, in <module>
    LM.download_subtitle(files, options.download)
  File "./lm.py", line 1005, in download_subtitle
    ref, query = self.download_subtitles_query( files, language )
  File "./lm.py", line 1047, in download_subtitles_query
    filedir = os.path.dirname(f).decode(sys.getdefaultencoding())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 18: ordinal not in range(128)

Regards
Matthieu

Thank you for this user experience:

Could you please try this same call with debug mode (./lm.py ~/Vidéos/ --download eng --debug).
It will create a lo file in ~/.lm/lm_log.txt
Could you send it to me by mail? polluxxx at gmail dot com

Log sent

This issue should be corrected in last update (tar.gz download also updated)

It doesn't work...

[matthieu@matthieu:~/Programmes/lm]$ git pull
Already up-to-date.
[matthieu@matthieu:~/Programmes/lm]$ ./lm.py ~/Vidéos/ --download eng --debug
2012-03-01 04:25:31,896: LM UTIL - INFO - argparse namespace: Namespace(alphabetical=False, confirm=False, debug=True, delete_cache=False, download='eng', files=['/home/matthieu/Vid\xc3\xa9os/'], filter=None, long=False, outline=False, reset=False, reverse=False, show=False, show_imdb=False, upload=False, version=False, very_long=False)
2012-03-01 04:25:31,896: LM UTIL - INFO - arg files type: <type 'str'>
2012-03-01 04:25:31,897: LM UTIL - INFO - file system encoding: UTF-8
2012-03-01 04:25:31,897: LM UTIL - INFO - system encoding: ascii
2012-03-01 04:25:31,897: LM UTIL - INFO - locale encoding: UTF8
2012-03-01 04:25:31,897: LM - INFO - LM initialization
2012-03-01 04:25:31,897: LM - INFO - loading cache_path
2012-03-01 04:25:31,902: LM - INFO - cache_path file loaded successfully
2012-03-01 04:25:31,902: LM - INFO - loading cache_hash
2012-03-01 04:25:31,917: LM - INFO - cache_hash file loaded successfully
2012-03-01 04:25:31,967: LM - INFO - interpreting file/dir argument
2012-03-01 04:25:32,006: LM - INFO - saving caches
2012-03-01 04:25:32,007: LM - INFO - synchronizing caches
2012-03-01 04:25:32,007: LM - INFO - saving cache_path
2012-03-01 04:25:32,013: LM - INFO - saving cache_hash
2012-03-01 04:25:32,029: LM - INFO - cache_hash saved
Traceback (most recent call last):
  File "./lm.py", line 1436, in <module>
    LM.download_subtitle(files, options.download)
  File "./lm.py", line 1005, in download_subtitle
    ref, query = self.download_subtitles_query( files, language )
  File "./lm.py", line 1047, in download_subtitles_query
    filedir = os.path.dirname(f).decode(sys.getdefaultencoding())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 18: ordinal not in range(128)

I was able to reproduce this bug.
I corrected a string decoding call when download request is built.

I think(/hope?) it will work now.
Thank you for your feedback.

It works, thanks :)