Opened 7 years ago

Closed 6 years ago

#1637 closed bug (Fixed)

deluge-console "pause --help" fails for non latin locale

Reported by: non7top Owned by: Cas
Priority: minor Milestone: 1.3.3
Component: Console UI Version: 1.3.2
Keywords: Cc:

Description

non7top@s ~/bin $ LC_ALL=C deluge-console "pause --help"
Usage: pause [ * | <torrent-id> [<torrent-id> ...] ]

Options:
  -h, --help  show this help message and exit

Pause a torrent

non7top@s ~/bin $ deluge-console "pause --help"
Error parsing options: 'ascii' codec can't decode byte 0xd0 in position 54: ordinal not in range(128)

non7top@s ~/bin $ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

non7top@s ~/bin $ python --version
Python 2.7.1

Other commands show same error with --help option

Change History (9)

comment:1 Changed 7 years ago by Cas

  • Component changed from other to console
  • Priority changed from major to minor
  • Type changed from defect to bug

What version of Deluge are you using?

comment:2 Changed 7 years ago by non7top

comment:3 Changed 7 years ago by Cas

  • Milestone changed from Future to 1.4.0
  • Owner set to nick
  • Status changed from new to assigned

comment:4 Changed 7 years ago by nick

  • Status changed from assigned to pending

This doesn't happen with the new console code for me, only with the older version. Are you sure you're running the newest version? (

Also, if you just run:

deluge-console --help

You should get the bug and a full stack trace which would be useful to have. I believe this isn't a problem with deluge but rather something wrong in optparse.

comment:5 Changed 7 years ago by non7top

  • Status changed from pending to new
$ deluge-console --help
Traceback (most recent call last):
  File "/usr/bin/deluge-console", line 9, in <module>
    load_entry_point('deluge==1.3.900-dev', 'console_scripts', 'deluge-console')()
  File "/usr/lib/python2.7/site-packages/deluge/ui/console/main.py", line 124, in start
    Console().start()
  File "/usr/lib/python2.7/site-packages/deluge/ui/console/main.py", line 118, in start
    super(Console, self).start()
  File "/usr/lib/python2.7/site-packages/deluge/ui/ui.py", line 90, in start
    (self.__options, self.__args) = self.__parser.parse_args()
  File "/usr/lib/python2.7/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1434, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1509, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.7/optparse.py", line 788, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib/python2.7/optparse.py", line 810, in take_action
    parser.print_help()
  File "/usr/lib/python2.7/optparse.py", line 1664, in print_help
    file.write(self.format_help().encode(encoding, "replace"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 33: ordinal not in range(128)

commit: 63d0d0c69bbc77f151c2bf38b806895b603e039f

comment:6 Changed 7 years ago by Cas

  • Resolution set to invalid
  • Status changed from new to closed

Your OS is trying to convert non-ascii characters to ascii. This is normally due to not having LANG or LC_ALL setup properly.

This is an example of how to fix this:

export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'

comment:7 Changed 7 years ago by non7top

  • Resolution invalid deleted
  • Status changed from closed to reopened

As I've said my locale is not en_US.UTF-8 isn't deluge supposed to be only run on different locales other than en_US.UTF-8?

comment:8 Changed 6 years ago by Cas

  • Milestone changed from 1.4.0 to 1.3.3
  • Owner changed from nick to Cas
  • Status changed from reopened to accepted
  • Version changed from 1.3.0_dev to 1.3.2

Sorry did not see that it was an optparse issue but I can now reproduce with that same commit 63d0d0 and 1.3.2

I have a fix for 1.3-stable here but needs verified that it is correct.

We have broken translations in master gtk ui due to lots of changes so will have to wait to test the fix there.

comment:9 Changed 6 years ago by Cas

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in 1.3-stable: 28fc325 and master: b301051c

Note: See TracTickets for help on using tickets.