[GRASS-SVN] r70141 - grass/trunk/scripts/d.correlate
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 27 03:42:51 PST 2016
Author: martinl
Date: 2016-12-27 03:42:51 -0800 (Tue, 27 Dec 2016)
New Revision: 70141
Modified:
grass/trunk/scripts/d.correlate/d.correlate.py
Log:
d.correlate: catch exceptions cause by d.text (no monitor)
Modified: grass/trunk/scripts/d.correlate/d.correlate.py
===================================================================
--- grass/trunk/scripts/d.correlate/d.correlate.py 2016-12-27 11:34:10 UTC (rev 70140)
+++ grass/trunk/scripts/d.correlate/d.correlate.py 2016-12-27 11:42:51 UTC (rev 70141)
@@ -30,8 +30,8 @@
import os
from grass.script.utils import try_remove
from grass.script import core as gcore
+from grass.exceptions import CalledModuleError
-
def main():
layers = options['map'].split(',')
@@ -44,9 +44,12 @@
if not gcore.find_file(map, element='cell')['file']:
gcore.fatal(_("Raster map <%s> not found") % map)
- gcore.write_command('d.text', color='black', size=4, line=1,
- stdin="CORRELATION")
-
+ try:
+ gcore.write_command('d.text', color='black', size=4, line=1,
+ stdin="CORRELATION")
+ except CalledModuleError:
+ return 1
+
os.environ['GRASS_RENDER_FILE_READ'] = 'TRUE'
colors = "red black blue green gray violet".split()
@@ -108,6 +111,8 @@
try_remove(tmpfile)
+ return 0
+
if __name__ == "__main__":
options, flags = gcore.parser()
- main()
+ sys.exit(main())
More information about the grass-commit
mailing list