Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 0ac0616

Browse files
committed
Don't fail if we can't set locale (debian bug #697864)
1 parent 5fffcc4 commit 0ac0616

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

virtinst/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ def setupParser(usage=None):
145145
return parser
146146

147147
def setupGettext():
148-
locale.setlocale(locale.LC_ALL, '')
148+
try:
149+
locale.setlocale(locale.LC_ALL, '')
150+
except locale.Error, e:
151+
print >> sys.stderr, "warning: failed to set locale, defaulting to C"
152+
os.environ['LC_ALL'] = 'C'
153+
locale.setlocale(locale.LC_ALL, 'C')
154+
149155
gettext.bindtextdomain("virtinst")
150156
gettext.install("virtinst")
151157

0 commit comments

Comments
 (0)