[GRASS-SVN] r60662 - grass/trunk/lib/python/script
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jun 1 20:13:38 PDT 2014
Author: glynn
Date: 2014-06-01 20:13:38 -0700 (Sun, 01 Jun 2014)
New Revision: 60662
Modified:
grass/trunk/lib/python/script/raster.py
Log:
Pass r.mapcalc expressions via stdin rather than expression=
Modified: grass/trunk/lib/python/script/raster.py
===================================================================
--- grass/trunk/lib/python/script/raster.py 2014-06-01 18:39:04 UTC (rev 60661)
+++ grass/trunk/lib/python/script/raster.py 2014-06-02 03:13:38 UTC (rev 60662)
@@ -98,10 +98,10 @@
t = string.Template(exp)
e = t.substitute(**kwargs)
- if run_command('r.mapcalc', expression = e,
- quiet = quiet,
- verbose = verbose,
- overwrite = overwrite) != 0:
+ if write_command('r.mapcalc', file = '-', stdin = e,
+ quiet = quiet,
+ verbose = verbose,
+ overwrite = overwrite) != 0:
fatal(_("An error occurred while running r.mapcalc"))
@@ -131,10 +131,13 @@
t = string.Template(exp)
e = t.substitute(**kwargs)
- return start_command('r.mapcalc', expression = e,
- quiet = quiet,
- verbose = verbose,
- overwrite = overwrite)
+ p = feed_command('r.mapcalc', file = '-',
+ quiet = quiet,
+ verbose = verbose,
+ overwrite = overwrite)
+ p.stdin.write(e)
+ p.stdin.close()
+ return p
# interface to r.what
def raster_what(map, coord):
More information about the grass-commit
mailing list