[GRASS-SVN] r59655 - grass/trunk/lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 9 03:41:49 PDT 2014
Author: marisn
Date: 2014-04-09 03:41:49 -0700 (Wed, 09 Apr 2014)
New Revision: 59655
Modified:
grass/trunk/lib/init/grass.py
Log:
Catch misconfigured locale settings
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2014-04-09 09:55:22 UTC (rev 59654)
+++ grass/trunk/lib/init/grass.py 2014-04-09 10:41:49 UTC (rev 59655)
@@ -789,7 +789,16 @@
# Language override is disabled (system language specified)
# As by default program runs with C locale, but users expect to
# have their default locale, we'll just set default locale
- locale.setlocale(locale.LC_ALL, '')
+ try:
+ locale.setlocale(locale.LC_ALL, '')
+ except locale.Error, e:
+ # If we get here, system locale settings are terribly wrong
+ # There is no point to continue as GRASS/Python will fail
+ # in some other unpredictable way.
+ print "System locale is not usable. It indicates misconfigured environment."
+ print "Reported error message: %s" % e
+ sys.exit("Fix system locale settings and then try again.")
+
language, encoding = locale.getdefaultlocale()
if not language:
warning("Default locale settings are missing. GRASS running with C locale.")
More information about the grass-commit
mailing list