[GRASS-SVN] r66754 - grass/trunk/lib/python/pygrass/modules/grid

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 5 19:05:21 PST 2015


Author: annakrat
Date: 2015-11-05 19:05:21 -0800 (Thu, 05 Nov 2015)
New Revision: 66754

Modified:
   grass/trunk/lib/python/pygrass/modules/grid/grid.py
Log:
pygrass: fix GridModule on windows - popen must be called with shell=True on windows; fixed typo

Modified: grass/trunk/lib/python/pygrass/modules/grid/grid.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/grid/grid.py	2015-11-06 02:49:25 UTC (rev 66753)
+++ grass/trunk/lib/python/pygrass/modules/grid/grid.py	2015-11-06 03:05:21 UTC (rev 66754)
@@ -2,6 +2,7 @@
 from __future__ import (nested_scopes, generators, division, absolute_import,
                         with_statement, print_function, unicode_literals)
 import os
+import sys
 import multiprocessing as mltp
 import subprocess as sub
 import shutil as sht
@@ -352,6 +353,7 @@
     src, dst = get_mapset(gisrc_src, gisrc_dst)
     env = os.environ.copy()
     env['GISRC'] = gisrc_dst
+    shell = True if sys.platform == 'win32' else False
     if mapnames:
         inputs = dict(cmd['inputs'])
         # reset the inputs to
@@ -359,16 +361,16 @@
             inputs[key] = mapnames[key]
         cmd['inputs'] = inputs.items()
         # set the region to the tile
-        sub.Popen(['g,region', 'raster=%s' % key], env=env).wait()
+        sub.Popen(['g.region', 'raster=%s' % key], shell=shell, env=env).wait()
     else:
         # set the computational region
         lcmd = ['g.region', ]
         lcmd.extend(["%s=%s" % (k, v) for k, v in bbox.items()])
-        sub.Popen(lcmd, env=env).wait()
+        sub.Popen(lcmd, shell=shell, env=env).wait()
     if groups:
         copy_groups(groups, gisrc_src, gisrc_dst)
     # run the grass command
-    sub.Popen(get_cmd(cmd), env=env).wait()
+    sub.Popen(get_cmd(cmd), shell=shell, env=env).wait()
     # remove temp GISRC
     os.remove(gisrc_dst)
 



More information about the grass-commit mailing list