[virt-tools-list] virt-manager: "locale.Error: unsupported locale setting" error and workaround

Cole Robinson crobinso at redhat.com
Fri Sep 19 23:55:13 UTC 2014

On 09/19/2014 08:22 AM, Julio Faracco wrote:
> 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? If someone can analyze the patch. 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! =)

Thanks for the patch, I think it's okay but I'm trying to understand what the
root issue is.

Can you explain the what issue you are seeing before this patch, and how this
patch changes behavior?

What's the output of 'echo $LANG' ?


> 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 at br.ibm.com>
> --- 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)

More information about the virt-tools-list mailing list