Comment 49 for bug 989496

Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote :

Hey, thanks for working on this! ;-)

Unfortunately, with your branch I get a crash directly on start (FWIW, I've only built duplicity in-tree, and not installed it).
$ bin/duplicity --help
Traceback (most recent call last):
  File "bin/duplicity", line 1470, in <module>
    with_tempdir(main)
  File "bin/duplicity", line 1463, in with_tempdir
    fn()
  File "bin/duplicity", line 1316, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/home/milan/Dev/duplicity/duplicity/commandline.py", line 999, in ProcessCommandLine
    args = parse_cmdline_options(cmdline_list)
  File "/home/milan/Dev/duplicity/duplicity/commandline.py", line 560, in parse_cmdline_options
    (options, args) = parser.parse_args()
  File "/usr/lib64/python2.7/optparse.py", line 1399, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.7/optparse.py", line 1439, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib64/python2.7/optparse.py", line 1514, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib64/python2.7/optparse.py", line 788, in process
    self.action, self.dest, opt, value, values, parser)
  File "/home/milan/Dev/duplicity/duplicity/commandline.py", line 171, in take_action
    self, action, dest, opt, value, values, parser)
  File "/usr/lib64/python2.7/optparse.py", line 810, in take_action
    parser.print_help()
  File "/home/milan/Dev/duplicity/duplicity/commandline.py", line 198, in print_help
    file.write(self.format_help().decode('utf-8').encode(encoding, "replace"))
  File "/usr/lib64/python2.7/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 1997: ordinal not in range(128)

I think you can replicate the problem by using the fr_FR.utf8 locale. with LC_ALL=C I don't get the problem at all.

Have you considered the following change? I don't know anything about gettext with Python, but this guy seems to have strong feelings about it.
http://www.wefearchange.org/2012/06/the-right-way-to-internationalize-your.html

diff -u duplicity/__init__.py /usr/lib64/python2.7/site-packages/duplicity/__init__.py
--- duplicity/__init__.py 2013-08-08 11:15:50.648693111 +0200
+++ /usr/lib64/python2.7/site-packages/duplicity/__init__.py 2013-08-07 23:20:59.716631994 +0200
@@ -20,4 +20,4 @@
 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 import gettext
-gettext.install('duplicity', codeset='utf8')
+gettext.install('duplicity', codeset='utf8', unicode=True, names='ngettext')