From 4bdae6b9d74fec4f1b10c108123f551bcdff177f Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 9 Sep 2013 13:33:43 -0400 Subject: [PATCH] Be more careful about setting the locale --- lib/matplotlib/tests/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/__init__.py b/lib/matplotlib/tests/__init__.py index 7b181d438071..a1b5b29b0be2 100644 --- a/lib/matplotlib/tests/__init__.py +++ b/lib/matplotlib/tests/__init__.py @@ -11,7 +11,17 @@ def setup(): # The baseline images are created in this locale, so we should use # it during all of the tests. import locale - locale.setlocale(locale.LC_ALL, str('en_US.UTF-8')) + import warnings + + try: + locale.setlocale(locale.LC_ALL, str('en_US.UTF-8')) + except: + try: + locale.setlocale(locale.LC_ALL, str('English_United States.1252')) + except: + warnings.warn( + "Could not set locale to English/United States. " + "Some date-related tests may fail") use('Agg', warn=False) # use Agg backend for these tests