"locale.Error: unsupported locale setting" error and workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone!

Just a simple doubt about this fixed error in virt-manager.
I added a line to set default locale into LC_ALL when the error occurs.
Is it can be done? Well, it solved some annoying debug that me and other
users were having.

Well, do you think it is necessary?

Anyway, I attached the patch that I send to people who is reporting
those issues to me.

If you guarantee to me that a simple "pass" in the code won't affect
anything, please forgot the fix/patch and I will do too. And I will
guide user to forget those issues.

Thanks guys! =)
Patch to set a default locale into LC_ALL. This exception occurs when a user
has a bug with your locale. This fix avoid that the locale bug reflects into
virt-manager.

Signed-off-by: Julio Faracco <jfaracco@xxxxxxxxxx>
--- virt-manager/virtinst/__init__.py	2014-09-18 10:19:54.260428079 -0300
+++ __init__.py	2014-09-18 10:36:32.109532808 -0300
@@ -26,7 +26,7 @@ def _setup_i18n():
         locale.setlocale(locale.LC_ALL, '')
     except:
         # Can happen if user passed a bogus LANG
-        pass
+        locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())
 
     gettext.install("virt-manager", _cliconfig.gettext_dir)
     gettext.bindtextdomain("virt-manager", _cliconfig.gettext_dir)
_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux