[GRASS-SVN] r64715 - grass/branches/releasebranch_7_0/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 21 06:17:42 PST 2015


Author: martinl
Date: 2015-02-21 06:17:42 -0800 (Sat, 21 Feb 2015)
New Revision: 64715

Modified:
   grass/branches/releasebranch_7_0/lib/init/grass.py
Log:
grass.py: don't fail on invalid RC file (parse line to key, value)
          (merge r64690 from trunk)


Modified: grass/branches/releasebranch_7_0/lib/init/grass.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/init/grass.py	2015-02-21 14:17:02 UTC (rev 64714)
+++ grass/branches/releasebranch_7_0/lib/init/grass.py	2015-02-21 14:17:42 UTC (rev 64715)
@@ -295,7 +295,11 @@
         return kv
 
     for line in f:
-        k, v = line.split(':', 1)
+        try:
+            k, v = line.split(':', 1)
+        except ValueError as e:
+            sys.stderr.write(_("ERROR: Invalid line in RC file: '%s' (%s)\n") % (line, e))
+            continue
         kv[k.strip()] = v.strip()
     f.close()
 



More information about the grass-commit mailing list