[GRASS-SVN] r53504 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 19 07:48:00 PDT 2012


Author: martinl
Date: 2012-10-19 07:48:00 -0700 (Fri, 19 Oct 2012)
New Revision: 53504

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: better check for invalid lang settings


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2012-10-19 14:46:22 UTC (rev 53503)
+++ grass/trunk/lib/init/grass.py	2012-10-19 14:48:00 UTC (rev 53504)
@@ -671,9 +671,13 @@
                 locale.setlocale(locale.LC_ALL, language)
             except:
                 # If we got so far, provided locale is not supported on this system
-                print "Failed to set LC_ALL to %s" % language
-                default_locale = locale.getdefaultlocale()
-                if default_locale[0]:
+                sys.stderr.write("Failed to set LC_ALL to %s\n" % language)
+                try:
+                    default_locale = locale.getdefaultlocale()
+                except:
+                    default_locale = None
+                
+                if default_locale and default_locale[0]:
                     language = default_locale[0]
                 else:
                     language = 'C'



More information about the grass-commit mailing list