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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 26 19:37:48 EST 2011


Author: martinl
Date: 2011-11-26 16:37:48 -0800 (Sat, 26 Nov 2011)
New Revision: 49375

Modified:
   grass/trunk/lib/python/task.py
Log:
attempt to fix running python scripts on Windows

Modified: grass/trunk/lib/python/task.py
===================================================================
--- grass/trunk/lib/python/task.py	2011-11-26 23:48:12 UTC (rev 49374)
+++ grass/trunk/lib/python/task.py	2011-11-27 00:37:48 UTC (rev 49375)
@@ -430,9 +430,14 @@
 
     @param cmd command (name of GRASS module)
     """
+    if sys.platform == 'win32' and os.path.splitext(cmd)[1] == '.py':
+        args = [sys.executable, cmd, '--interface-description']
+    else:
+        args = [cmd, '--interface-description']
+    
     try:
-        cmdout, cmderr = Popen([cmd, '--interface-description'], stdout = PIPE,
-                                     stderr = PIPE).communicate()
+        cmdout, cmderr = Popen(args, stdout = PIPE,
+                               stderr = PIPE).communicate()
     except OSError, e:
         raise ScriptError, _("Unable to fetch interface description for command '%(cmd)s'."
                              "\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' : e }



More information about the grass-commit mailing list