[GRASS-SVN] r68319 - grass/trunk/gui/wxpython/gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 26 08:38:36 PDT 2016
Author: martinl
Date: 2016-04-26 08:38:36 -0700 (Tue, 26 Apr 2016)
New Revision: 68319
Modified:
grass/trunk/gui/wxpython/gui_core/pyedit.py
Log:
pyedit: catch CalledModuleError in sample script (map not found)
Modified: grass/trunk/gui/wxpython/gui_core/pyedit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/pyedit.py 2016-04-26 15:29:54 UTC (rev 68318)
+++ grass/trunk/gui/wxpython/gui_core/pyedit.py 2016-04-26 15:38:36 UTC (rev 68319)
@@ -146,11 +146,15 @@
return r"""#!/usr/bin/env python
import grass.script as gscript
+from grass.exceptions import CalledModuleError
def main():
input_raster = 'elevation'
output_raster = 'high_areas'
- stats = gscript.parse_command('r.univar', map='elevation', flags='g')
+ try:
+ stats = gscript.parse_command('r.univar', map='elevation', flags='g')
+ except CalledModuleError as e:
+ gscript.fatal('{}'.format(e))
raster_mean = float(stats['mean'])
raster_stddev = float(stats['stddev'])
raster_high = raster_mean + raster_stddev
More information about the grass-commit
mailing list