exaile --help crashes for Russian locale

Bug #1154420 reported by Sergey Basalaev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
Low
Dustin Spicuzza

Bug Description

Probably affects other locales as well.

Reproducible on version 3.3.

$ exaile --help

Traceback (most recent call last):
  File "/usr/lib/exaile/exaile.py", line 68, in <module>
    main()
  File "/usr/lib/exaile/exaile.py", line 65, in main
    exaile = main.Exaile()
  File "/usr/lib/exaile/xl/main.py", line 83, in __init__
    (self.options, self.args) = self.get_options().parse_args()
  File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1439, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1514, 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 1669, in print_help
    file.write(self.format_help().encode(encoding, "replace"))
  File "/usr/lib/python2.7/optparse.py", line 1649, in format_help
    result.append(self.format_option_help(formatter))
  File "/usr/lib/python2.7/optparse.py", line 1636, in format_option_help
    return "".join(result[:-1])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Related branches

Revision history for this message
Sergey Basalaev (sbasalaev) wrote :

Works fine with C or EN locale

Mathias Brodala (mathbr)
Changed in exaile:
importance: Undecided → Low
status: New → Confirmed
Changed in exaile:
milestone: none → 3.3.2
Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

I've got this duplicated on my machine, but haven't been able to find a fix for it yet. It seems to be a common problem for optparse to have unicode errors.

See http://<email address hidden>/msg07227.html, and https://mail.python.org/pipermail/python-dev/2006-May/065458.html

Changed in exaile:
assignee: nobody → Dustin Spicuzza (dustin-virtualroadside)
status: Confirmed → In Progress
Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

As far as I can tell, there isn't a good way to fix this in Python 2.x. It no longer crashes, but will display a lot of gibberish on the terminal for some locales. It's not clear to me whether the terminal can be convinced to display anything else.

Tested using "LANGUAGE=ru_RU LANG=ru_RU LC_ALL=ru_RU ./exaile --help" after installing a Russian language pack using Kubuntu 13.10. Committed as r4407 @ trunk and r4336 @ 3.3.x.

If someone else has a better way of fixing this, please post a patch.

Changed in exaile:
status: In Progress → Fix Committed
Changed in exaile:
status: Fix Committed → Fix Released
Revision history for this message
Bernd Dietzel (1-launchpad-net-theregrunner-com) wrote :

Had the same problem with

pitivi --help

i modified the file /usr/lib/python2.7/optparse.py

from

file.write(self.format_help().encode(encoding, "replace"))

to

file.write(self.format_help().decode(encoding, "replace"))

after that --help works

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.