comparison piecrust/main.py @ 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 028df35a690e
children 869a206facd5
comparison
equal deleted inserted replaced
166:c132a2cba521 167:0a1736ef740d
50 self.plugin_loader = PluginLoader(self) 50 self.plugin_loader = PluginLoader(self)
51 self.env = None 51 self.env = None
52 52
53 53
54 def main(): 54 def main():
55 if sys.platform == 'darwin':
56 # There's a bug on MacOSX that can cause Python to be confused
57 # about the locale. Let's try to fix that.
58 # See: http://bugs.python.org/issue18378
59 import locale
60 try:
61 locale.getdefaultlocale()
62 except ValueError:
63 locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
64
55 argv = sys.argv 65 argv = sys.argv
56 pre_args = _pre_parse_chef_args(argv) 66 pre_args = _pre_parse_chef_args(argv)
57 try: 67 try:
58 exit_code = _run_chef(pre_args) 68 exit_code = _run_chef(pre_args)
59 except Exception as ex: 69 except Exception as ex: