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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 19 10:13:58 PST 2015


Author: martinl
Date: 2015-02-19 10:13:58 -0800 (Thu, 19 Feb 2015)
New Revision: 64690

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


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2015-02-19 18:09:52 UTC (rev 64689)
+++ grass/trunk/lib/init/grass.py	2015-02-19 18:13:58 UTC (rev 64690)
@@ -298,7 +298,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