Sfoglia il codice sorgente

pygrass: Module class raise a CalledModuleError if return code is not 0, when user run a Module instance without asking to handle the process (therefore with finish_==True).

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61229 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 10 anni fa
parent
commit
f58fc60726
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      lib/python/pygrass/modules/interface/module.py

+ 4 - 3
lib/python/pygrass/modules/interface/module.py

@@ -10,6 +10,7 @@ else:
 from xml.etree.ElementTree import fromstring
 import time
 
+from grass.exceptions import CalledModuleError
 from grass.script.core import Popen, PIPE
 from grass.pygrass.errors import GrassError, ParameterError
 from grass.pygrass.functions import docstring_property
@@ -562,9 +563,9 @@ class Module(object):
             self.outputs['stdout'].value = stdout if stdout else ''
             self.outputs['stderr'].value = stderr if stderr else ''
             self.time = time.time() - start
-            #if self.popen.poll():
-            #    raise CalledModuleError(self.popen.returncode, self.get_bash(),
-            #                            {}, stderr)
+            if self.popen.poll():
+                raise CalledModuleError(self.popen.returncode, self.get_bash(),
+                                        {}, stderr)
         return self
 
 ###############################################################################