[GRASS-SVN] r52313 - grass/trunk/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 5 09:16:49 PDT 2012


Author: mmetz
Date: 2012-07-05 09:16:49 -0700 (Thu, 05 Jul 2012)
New Revision: 52313

Modified:
   grass/trunk/lib/python/task.py
Log:
python lib: 'Unable to fetch interface description' is only try if g.parser exits with EXIT_FAILURE

Modified: grass/trunk/lib/python/task.py
===================================================================
--- grass/trunk/lib/python/task.py	2012-07-05 15:04:20 UTC (rev 52312)
+++ grass/trunk/lib/python/task.py	2012-07-05 16:16:49 UTC (rev 52313)
@@ -431,8 +431,9 @@
     @param cmd command (name of GRASS module)
     """
     try:
-        cmdout, cmderr = Popen([cmd, '--interface-description'], stdout = PIPE,
-                               stderr = PIPE).communicate()
+	p = Popen([cmd, '--interface-description'], stdout = PIPE,
+						    stderr = PIPE)
+        cmdout, cmderr = p.communicate()
         
         # TODO: replace ugly hack bellow
         if not cmdout and sys.platform == 'win32':
@@ -440,10 +441,11 @@
                 cmd += '.py'
             
             os.chdir(os.path.join(os.getenv('GISBASE'), 'scripts'))
-            cmdout, cmderr = Popen([sys.executable, cmd, '--interface-description'], stdout = PIPE,
-                                   stderr = PIPE).communicate()
+	    p = Popen([sys.executable, cmd, '--interface-description'],
+		      stdout = PIPE, stderr = PIPE)
+            cmdout, cmderr = p.communicate()
         
-        if cmderr:
+        if p.returncode != 0:
             raise ScriptError, _("Unable to fetch interface description for command '%(cmd)s'."
                                  "\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' : decode(cmderr) }
     



More information about the grass-commit mailing list