Avoid crashing if LC_ALL is not defined by user (issue #517)

This commit is contained in:
Nicolargo 2015-02-26 10:52:50 +01:00
parent 2f7c672054
commit 3c9fba3dcf

View File

@ -95,7 +95,15 @@ def main():
Run it... Run it...
""" """
# Setup translations # Setup translations
locale.setlocale(locale.LC_ALL, '') try:
locale.setlocale(locale.LC_ALL, '')
except locale.Error:
# Issue #517
# Setting LC_ALL to '' should not generate an error unless LC_ALL is not
# defined in the user environment, which can be the case when used via SSH.
# So simply skip this error, as python will use the C locale by default.
logger.warning("No locale LC_ALL variable found. Use the default C locale.")
pass
gettext.install(gettext_domain, locale_dir) gettext.install(gettext_domain, locale_dir)
# Share global var # Share global var