Просмотр исходного кода

attempt to fix running python scripts on Windows

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49375 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 лет назад
Родитель
Сommit
5b70962521
1 измененных файлов с 7 добавлено и 2 удалено
  1. 7 2
      lib/python/task.py

+ 7 - 2
lib/python/task.py

@@ -430,9 +430,14 @@ def get_interface_description(cmd):
 
     @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 }