Mercurial > piecrust2
changeset 167:0a1736ef740d
chef: Work around a bug in MacOSX where the default locale doesn't work.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 02 Jan 2015 19:47:41 -0800 |
parents | c132a2cba521 |
children | 56d6b17e057b |
files | piecrust/main.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/main.py Thu Jan 01 23:13:38 2015 -0800 +++ b/piecrust/main.py Fri Jan 02 19:47:41 2015 -0800 @@ -52,6 +52,16 @@ def main(): + if sys.platform == 'darwin': + # There's a bug on MacOSX that can cause Python to be confused + # about the locale. Let's try to fix that. + # See: http://bugs.python.org/issue18378 + import locale + try: + locale.getdefaultlocale() + except ValueError: + locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') + argv = sys.argv pre_args = _pre_parse_chef_args(argv) try: