Issue2569
Created on 2017-03-13.22:39:33 by jamesmudd, last changed 2018-02-28.23:27:17 by jeff.allen.
Messages | |||
---|---|---|---|
msg11223 (view) | Author: James Mudd (jamesmudd) | Date: 2017-03-13.22:39:32 | |
Trying to execute the jython using the exe or python launch script on Windows fails if JAVA_HOME environment variable is set Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\Users\user\Desktop\dist\bin>jython.exe Jython 2.7.1rc1 (, Mar 13 2017, 08:51:49) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121 Type "help", "copyright", "credits" or "license" for more information. >>> KeyboardInterrupt -------- Works Ok C:\Users\user\Desktop\dist\bin>set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_121" C:\Users\user\Desktop\dist\bin>jython.exe Traceback (most recent call last): File "jython.py", line 444, in <module> if __name__ == "__main__": File "jython.py", line 435, in main print command File "subprocess.py", line 168, in call File "subprocess.py", line 390, in __init__ File "subprocess.py", line 640, in _execute_child WindowsError: [Error 5] Access is denied Failed to execute script jython --------- Fails Running as admin doesn't help. I think the problem is when JAVA_HOME is set then cmd used to invoke java is the full path C:\Program Files\Java\jdk1.8.0_121\bin\java and python doesn't seem to have permission to launch this. However when JAVA_HOME is not set the cmd used is just java and it relies on java being on the path, it seems python can launch this? Any ideas for a fix? Or others give it a try and see if it fails for you? |
|||
msg11229 (view) | Author: Jeff Allen (jeff.allen) | Date: 2017-03-14.19:57:58 | |
I can certainly reproduce, but it works if I remove the quotes. > set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_121" > jython --print "\"C:\Program Files\Java\jdk1.8.0_121\"\bin\java" -Xmx512m -Xss1024k -classpath C:\jython\2.7.1rc1\jython.jar;. -Dpython.home=C:\jython\2.7.1rc1 -Dpython.executable=C:\jython\2.7.1rc1\bin\jython.exe -Dpython.launcher.uname=windows -Dpython.launcher.tty=true org.python.util.jython Notice the questionable use of quotes? Tidy them up and it runs. > "C:\Program Files\Java\jdk1.8.0_121\bin\java" -Xmx512m -Xss1024k -classpath C:\jython\2.7.1rc1\jython.jar;. -Dpython.home=C:\jython\2.7.1rc1 -Dpython.executable=C:\jython\2.7.1rc1\bin\jython.exe -Dpython.launcher.uname=windows -Dpython.launcher.tty=true org.python.util.jython Jython 2.7.1rc1 (default:8a87a1e6d515, Feb 28 2017, 04:33:36) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121 Type "help", "copyright", "credits" or "license" for more information. >>> exit() And similarly, if you define the variable without them: > set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121 > jython Jython 2.7.1rc1 (default:8a87a1e6d515, Feb 28 2017, 04:33:36) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121 Type "help", "copyright", "credits" or "license" for more information. >>> I know it's quite common to quote paths in environment variables or scripts, especially if there are spaces invoilved, but this time it works against you. If we wanted to be resilient to this kind of thing (#2346), maybe we'd strip them in the launcher before composing the path? |
|||
msg11728 (view) | Author: Jeff Allen (jeff.allen) | Date: 2018-02-28.23:27:17 | |
Changes to the launcher since 2.7.1 include a tolerance for extra quotes. C:\Users\Jeff\Documents\Eclipse\jython-trunk>set JAVA_HOME JAVA_HOME="C:\Program Files\Java\jdk1.8.0_151" C:\Users\Jeff\Documents\Eclipse\jython-trunk>dist\bin\jython -c "print 42" 42 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2018-02-28 23:27:17 | jeff.allen | set | status: open -> closed resolution: fixed messages: + msg11728 |
2017-03-14 19:57:59 | jeff.allen | set | nosy:
+ jeff.allen messages: + msg11229 |
2017-03-13 22:39:33 | jamesmudd | create |
Supported by Python Software Foundation,
Powered by Roundup