[GRASS-SVN] r38661 - grass/trunk/scripts/r.mask

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 9 18:05:24 EDT 2009


Author: neteler
Date: 2009-08-09 18:05:24 -0400 (Sun, 09 Aug 2009)
New Revision: 38661

Modified:
   grass/trunk/scripts/r.mask/r.mask.py
Log:
test if mask map exists; fix appended messages

Modified: grass/trunk/scripts/r.mask/r.mask.py
===================================================================
--- grass/trunk/scripts/r.mask/r.mask.py	2009-08-09 22:00:03 UTC (rev 38660)
+++ grass/trunk/scripts/r.mask/r.mask.py	2009-08-09 22:05:24 UTC (rev 38661)
@@ -60,6 +60,10 @@
     if not remove and not input:
 	grass.fatal(_("Required parameter <input> not set"))
 
+    #check if input file exists
+    if not grass.find_file(input)['file'] and not remove:
+        grass.fatal(_("<%s> does not exist.") % input)
+
     mapset = grass.gisenv()['MAPSET']
     exists = bool(grass.find_file('MASK', element = 'cell', mapset = mapset)['file'])
 
@@ -88,8 +92,8 @@
 	else:
 	    grass.message(_("MASK created."))
 
-        grass.message(_("All subsequent raster operations will be limited to MASK area") +
-		      "Removing or renaming raster file named MASK will" +
+        grass.message(_("All subsequent raster operations will be limited to MASK area. ") +
+		      "Removing or renaming raster file named MASK will " +
 		      "restore raster operations to normal")
 
 if __name__ == "__main__":



More information about the grass-commit mailing list