From 11c8c1b66dfa4d3c8a366da1a9aaad0a2242e309 Mon Sep 17 00:00:00 2001 From: George Yoshida Date: Tue, 14 Mar 2017 17:52:26 +0100 Subject: [PATCH] When locale is not initialized, skip setlocale When locale is not initialized, locale.setlocale(locale.LC_ALL, '') fails. In that case, just skip setlocale process. Fixes #93 --- percol/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/percol/cli.py b/percol/cli.py index 4be334f..c7057ef 100644 --- a/percol/cli.py +++ b/percol/cli.py @@ -119,7 +119,10 @@ def setup_options(parser): help = "exit immediately with doing nothing to cache module files and speed up start-up time") def set_proper_locale(options): - locale.setlocale(locale.LC_ALL, '') + try: + locale.setlocale(locale.LC_ALL, '') + except Exception as e: + debug.log("Exception in setlocale", e) output_encoding = locale.getpreferredencoding() if options.output_encoding: output_encoding = options.output_encoding