[GRASS-SVN] r32333 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 27 07:30:52 EDT 2008
Author: martinl
Date: 2008-07-27 07:30:52 -0400 (Sun, 27 Jul 2008)
New Revision: 32333
Modified:
grass/trunk/lib/python/grass.py
Log:
pygrass: don't crash when mapset has no elements
Modified: grass/trunk/lib/python/grass.py
===================================================================
--- grass/trunk/lib/python/grass.py 2008-07-27 11:06:35 UTC (rev 32332)
+++ grass/trunk/lib/python/grass.py 2008-07-27 11:30:52 UTC (rev 32333)
@@ -159,6 +159,7 @@
dashes_re = re.compile("^----+$")
mapset_re = re.compile("<(.*)>:$")
result = {}
+ mapset = None
for line in read_command("g.list", type = type).splitlines():
if line == "":
continue
@@ -169,7 +170,8 @@
mapset = m.group(1)
result[mapset] = []
continue
- result[mapset].extend(line.split())
+ if mapset:
+ result[mapset].extend(line.split())
return result
def _concat(xs):
More information about the grass-commit
mailing list