Unicode exceptions issue

Bug #1386373 reported by Eugene Morozov on 2014-10-27
This bug affects 9 people
Affects Status Importance Assigned to Milestone

Bug Description

Duplicity fails to report correct exception when run in non-ascii locale. For example, if python-boto dependency is not installed and I attempt any operation involving interaction with Amazon S3, it fails with non-descriptive error:
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1538, in <module>
    log.FatalError(u"%s: %s" % (e.__class__.__name__, util.uexc(e)),
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 76, in uexc
    return ufn(str(e))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)

This error can be easily fixed by replacing body of the uexc function in the utils module with the following statement:
return ufn(unicode(e).encode('utf-8'))

I'm using duplicity 0.6.23 (the code is the same in the latest version of duplicity) on Ubuntu 14.04.

mclovin (asdflea) wrote :

This doesn't work for me, unfortunately. I got the same error.

Changed in duplicity:
status: New → Incomplete
status: Incomplete → In Progress
importance: Undecided → Medium
assignee: nobody → Kenneth Loafman (kenneth-loafman)
milestone: none → 0.7.16
Changed in duplicity:
assignee: Kenneth Loafman (kenneth-loafman) → nobody
status: In Progress → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
Paul Osbond (pa9l) on 2018-01-31
no longer affects: ubuntu
Raphaël Droz (raphael-droz) wrote :

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1546, in <module>
  File "/usr/bin/duplicity", line 1540, in with_tempdir
  File "/usr/bin/duplicity", line 1391, in main
  File "/usr/bin/duplicity", line 1510, in do_backup
  File "/usr/bin/duplicity", line 575, in full_backup
  File "/usr/bin/duplicity", line 456, in write_multivol
    (tdp, dest_filename, vol_num)))
  File "/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py", line 146, in schedule_task
    return self.__run_synchronously(fn, params)
  File "/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py", line 172, in __run_synchronously
    ret = fn(*params)
  File "/usr/bin/duplicity", line 455, in <lambda>
    vol_num: put(tdp, dest_filename, vol_num),
  File "/usr/bin/duplicity", line 344, in put
    backend.put(tdp, dest_filename)
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 376, in inner_retry
    % exception_traceback())
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 52, in exception_traceback
    return uexc(msg)
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 80, in uexc
    e = unicode(e).encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 728: ordinal not in range(128)

deja-dup 36.3-0ubuntu0.2
duplicity 0.7.12-1ubuntu1

same bug?

See also:

(will try duplicity 0.7.17 after my upgrade to 18.04)

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

Other bug subscribers