[GRASS-SVN] r58932 - grass/trunk/lib/python/pygrass/modules/interface
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 7 03:53:55 PST 2014
Author: zarch
Date: 2014-02-07 03:53:55 -0800 (Fri, 07 Feb 2014)
New Revision: 58932
Modified:
grass/trunk/lib/python/pygrass/modules/interface/module.py
Log:
Fix Popen using grass.script.core.Popen instead of subprocess.Popen
Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py 2014-02-07 11:52:09 UTC (rev 58931)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py 2014-02-07 11:53:55 UTC (rev 58932)
@@ -49,12 +49,11 @@
"""
from __future__ import print_function
-import subprocess
from itertools import izip_longest
from xml.etree.ElementTree import fromstring
import time
-
+from grass.script.core import Popen, PIPE
from grass.pygrass.errors import GrassError, ParameterError
from parameter import Parameter
from flag import Flag
@@ -240,8 +239,7 @@
self.name = cmd
try:
# call the command with --interface-description
- get_cmd_xml = subprocess.Popen([cmd, "--interface-description"],
- stdout=subprocess.PIPE)
+ get_cmd_xml = Popen([cmd, "--interface-description"], stdout=PIPE)
except OSError as e:
print("OSError error({0}): {1}".format(e.errno, e.strerror))
str_err = "Error running: `%s --interface-description`."
@@ -457,18 +455,18 @@
"""
if self.inputs['stdin'].value:
self.stdin = self.inputs['stdin'].value
- self.stdin_ = subprocess.PIPE
+ self.stdin_ = PIPE
if self.outputs['stdout'].value:
self.stdout_ = self.outputs['stdout'].value
if self.outputs['stderr'].value:
self.stderr_ = self.outputs['stderr'].value
cmd = self.make_cmd()
start = time.time()
- self.popen = subprocess.Popen(cmd,
- stdin=self.stdin_,
- stdout=self.stdout_,
- stderr=self.stderr_,
- env=self.env_)
+ self.popen = Popen(cmd,
+ stdin=self.stdin_,
+ stdout=self.stdout_,
+ stderr=self.stderr_,
+ env=self.env_)
if self.finish_:
stdout, stderr = self.popen.communicate(input=self.stdin)
self.outputs['stdout'].value = stdout if stdout else ''
More information about the grass-commit
mailing list