Explorar el Código

pygrass: fix GridModule on windows - popen must be called with shell=True on windows; fixed typo

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66754 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová hace 9 años
padre
commit
fa45395272
Se han modificado 1 ficheros con 5 adiciones y 3 borrados
  1. 5 3
      lib/python/pygrass/modules/grid/grid.py

+ 5 - 3
lib/python/pygrass/modules/grid/grid.py

@@ -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 @@ def cmd_exe(args):
     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 @@ def cmd_exe(args):
             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)