diff --git a/songbook.py b/songbook.py index 08cf8e80..3fd2af2e 100755 --- a/songbook.py +++ b/songbook.py @@ -36,7 +36,11 @@ def argument_parser(args): def main(): # set script locale to match user's - locale.setlocale(locale.LC_ALL, '') + try: + locale.setlocale(locale.LC_ALL, '') + except locale.Error as error: + # Locale is not installed on user's system, or wrongly configured. + sys.stderr.write("Locale error: {}\n".format(error.message)) options = argument_parser(sys.argv[1:]) diff --git a/songbook/plastex.py b/songbook/plastex.py index f1065024..5ba9a55d 100755 --- a/songbook/plastex.py +++ b/songbook/plastex.py @@ -80,7 +80,8 @@ def parsetex(filename): doc = SongParser.parse(filename) # /* BEGIN plasTeX patch - locale.setlocale(locale.LC_TIME, "%s.%s" % oldlocale) + if oldlocale[0] and oldlocale[1]: + locale.setlocale(locale.LC_TIME, "%s.%s" % oldlocale) # plasTeX patch END */ # Extraction des données