[GRASS-SVN] r43275 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 26 04:36:53 EDT 2010


Author: martinl
Date: 2010-08-26 08:36:53 +0000 (Thu, 26 Aug 2010)
New Revision: 43275

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
Log:
attempt to fix #1137
(merge r43266 from trunk)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2010-08-26 08:27:17 UTC (rev 43274)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2010-08-26 08:36:53 UTC (rev 43275)
@@ -102,11 +102,9 @@
 import goutput
 import utils
 from preferences import globalSettings as UserSettings
-try:
-    import subprocess
-except:
-    from compat import subprocess
 
+from grass.script import core as grass
+
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
 
 # From lib/gis/col_str.c, except purple which is mentioned
@@ -1803,13 +1801,12 @@
 
     Note: 'cmd' is given as string
     """
-    cmdout = os.popen(cmd + r' --interface-description', "r").read()
-    if not len(cmdout) > 0 :
-        raise IOError, _("Unable to fetch interface description for command '%s'.") % cmd
-    p = re.compile( '(grass-interface.dtd)')
-    p.search( cmdout )
-    cmdout = p.sub(globalvar.ETCDIR + r'/grass-interface.dtd', cmdout)
-    return cmdout
+    try:
+        cmdout = grass.Popen([cmd, '--interface-description'], stdout = grass.PIPE).communicate()[0]
+    except OSError:
+        raise gcmd.GException, _("Unable to fetch interface description for command '%s'.") % cmd
+    
+    return cmdout.replace('grass-interface.dtd', os.path.join(globalvar.ETCDIR, 'grass-interface.dtd'))
 
 class GrassGUIApp(wx.App):
     """



More information about the grass-commit mailing list