[GRASS-SVN] r59486 - grass/trunk/lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 27 12:54:20 PDT 2014


Author: martinl
Date: 2014-03-27 12:54:19 -0700 (Thu, 27 Mar 2014)
New Revision: 59486

Modified:
   grass/trunk/lib/python/script/core.py
Log:
modify libpython to fix calling Python script from Python script on Windows

Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py	2014-03-27 19:53:26 UTC (rev 59485)
+++ grass/trunk/lib/python/script/core.py	2014-03-27 19:54:19 UTC (rev 59486)
@@ -50,7 +50,13 @@
 
         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,



More information about the grass-commit mailing list