[GRASS-SVN] r52219 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 25 23:29:50 PDT 2012
Author: hamish
Date: 2012-06-25 23:29:50 -0700 (Mon, 25 Jun 2012)
New Revision: 52219
Modified:
grass/trunk/lib/python/raster.py
Log:
mapcalc_start() code example
Modified: grass/trunk/lib/python/raster.py
===================================================================
--- grass/trunk/lib/python/raster.py 2012-06-26 03:53:59 UTC (rev 52218)
+++ grass/trunk/lib/python/raster.py 2012-06-26 06:29:50 UTC (rev 52219)
@@ -106,15 +106,14 @@
\code
>>> expr1 = '"%s" = "%s" * 10' % (output, input)
- >>> p1 = grass.mapcalc_start(expr1, stdout = subprocess.PIPE)
- >>> print p1
- <subprocess.Popen object at 0xb7c12f6c>
- >>> # start other jobs now ...
-
- >>> # collect the results and wait for them to finish:
- >>> if not p1.stdout.closed:
- ... pout1 = p1.communicate()[0]
+ >>> expr2 = '...' # etc.
+ >>> # launch the jobs:
+ >>> p1 = grass.mapcalc_start(expr1)
+ >>> p2 = grass.mapcalc_start(expr2) # etc.
+ ...
+ >>> # wait for them to finish:
>>> p1.wait()
+ >>> p2.wait() # etc.
\endcode
(maybe stdout = subprocess.PIPE and p1.stdout.closed can be avoided)
More information about the grass-commit
mailing list