Pārlūkot izejas kodu

grass.py: fall back to C locale rather than refusing to start at all (see: https://lists.osgeo.org/pipermail/grass-user/2015-April/072331.html + https://lists.osgeo.org/pipermail/grass-user/2016-July/074488.html) (trunk, https://trac.osgeo.org/grass/changeset/68883)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@68885 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 gadi atpakaļ
vecāks
revīzija
2d2f16be0c
1 mainītis faili ar 7 papildinājumiem un 4 dzēšanām
  1. 7 4
      lib/init/grass.py

+ 7 - 4
lib/init/grass.py

@@ -802,10 +802,13 @@ def set_language():
             # 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.")
-        
+            print("System locale is not usable (LC_ALL variable not defined). "
+                  "It indicates misconfigured environment.")
+            print("Reported error message: %s" % e)
+            ## TOO DRASTIC: sys.exit("Fix system locale settings and then try again.")
+            locale.setlocale(locale.LC_ALL, 'C')
+            warning(_("Default locale settings are missing. GRASS running with C locale."))
+
         language, encoding = locale.getdefaultlocale()
         if not language:
             warning(_("Default locale settings are missing. GRASS running with C locale."))