Browse Source

grass.py: skip invalid elements

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@34899 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 years ago
parent
commit
1556de90dd
1 changed files with 5 additions and 1 deletions
  1. 5 1
      lib/python/grass.py

+ 5 - 1
lib/python/grass.py

@@ -304,7 +304,11 @@ def list_grouped2(type, pattern=None):
     mapset = None
     for line in read_command("g.mlist", flags="m",
                              type = type, pattern = pattern).splitlines():
-        map, mapset = line.split('@')
+        try:
+            map, mapset = line.split('@')
+        except ValueError:
+            print >> sys.stderr, "Invalid element '%s'" % line
+            continue
         
         if result.has_key(mapset):
             result[mapset].append(map)