[patch] Handle non-ascii system partitions

Jeff Fortin nekohayo at gmail.com
Wed Mar 21 02:17:16 UTC 2012


Hello!
Attached is a patch to fix a bug preventing many polyglots from using
liveusb-creator. The symptom is that when starting the app, you would
get this traceback (or a variant of it) no matter what kind of USB stick
you have plugged in, preventing you from selecting any usb device:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 586,
in msg_reply_handler
    reply_handler(*message.get_args_list(**get_args_opts))
  File "/usr/lib/python2.7/site-packages/liveusb/creator.py", line 451,
in handle_reply
    'label': str(dev.Get(device, 'IdLabel')).replace(' ', '_'),
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 1: ordinal not in range(128)


Well, it turns out that the cause, on my end, was a NTFS partition
called "Réservé au système" (System reserved) created by Windows. Looks
like the IdLabel is unicode, and trying to convert it to str tends to
blow things up. Luckily, the fix turned out to be trivial, so the
git-formatted patch is attached to this mail.

This probably fixes Redhat bugs 710785, 717356, 736643 and 768940 (from
a simple search of the word "IdLabel" in RHBZ) and will surely make many
international users happy. I haven't dug around to see if there could be
similar bugs related to unicode/string handling, but maybe that's
something you'd want to check :)

https://bugzilla.redhat.com/buglist.cgi?quicksearch=fedora
+liveusb-creator+encode
https://bugzilla.redhat.com/buglist.cgi?quicksearch=fedora
+liveusb-creator+range
etc.

Please let me know if it works for you, but keep me c.c.'ed because I'm
not subscribed to the mailing list.
Cheers

P.s.:
- Any ideas why the (pyqt4) app looks so.... Wineish on a stock Fedora
GNOME system? Isn't Qt supposed to mimic GTK's look?
- For some reason the application doesn't have a close button on its
window decoration in GNOME3/mutter. Maybe it's using the wrong dialog
type? Took a brief look, but since I'm only used to glade/PyGTK I don't
really know how to fix that. In any case, currently the only way to
close the application is to press Alt+F4, which is not intuitive!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://fedorahosted.org/pipermail/liveusb-creator/attachments/20120320/c898947f/attachment.html>


More information about the liveusb-creator mailing list