Ver código fonte

modify libpython to fix calling Python script from Python script on Windows

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59486 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 anos atrás
pai
commit
d218d714b4
1 arquivos alterados com 7 adições e 1 exclusões
  1. 7 1
      lib/python/script/core.py

+ 7 - 1
lib/python/script/core.py

@@ -50,7 +50,13 @@ class Popen(subprocess.Popen):
 
         if shell == None:
             shell = (sys.platform == "win32")
-
+        if sys.platform == "win32":
+            # get full path including file extension for scripts
+            fcmd = get_real_command(args[0]) 
+            if fcmd.endswith('.py'):
+                args[0] = fcmd
+                args.insert(0, sys.executable)
+        
         subprocess.Popen.__init__(self, args, bufsize, executable,
                                   stdin, stdout, stderr,
                                   preexec_fn, close_fds, shell,