Skip to content

Commit

Permalink
Don't warn about non-UTF8 locales when running on Python 2
Browse files Browse the repository at this point in the history
Python 2 doesn't change string behavior according to the locale env,
that's a py3 specific weirdness.

Also, reword the error message to better explain the issue to the user.
  • Loading branch information
Elad Alfassa committed Feb 2, 2016
1 parent 5ee3fbd commit 7688657
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sopel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
import locale
import sys
loc = locale.getlocale()
if not loc[1] or 'UTF-8' not in loc[1]:
print('WARNING!!! Something is messed up in your locale environment '
'variables (e.g. LC_ALL is set to "C"), which makes Python do stupid '
'things. If you get strange errors, please unset it, or set it to '
'something like "en_US.UTF-8".', file=sys.stderr)
if sys.version_info.major > 2:
if not loc[1] or 'UTF-8' not in loc[1]:
print('WARNING!!! You are running with a non-UTF8 locale environment '
'variables (e.g. LC_ALL is set to "C"), which makes Python 3 do '
'stupid things. If you get strange errors, please set it to '
'something like "en_US.UTF-8".', file=sys.stderr)


from collections import namedtuple
Expand Down

0 comments on commit 7688657

Please sign in to comment.