Message9976

Author zyasoft
Recipients pekka.klarck, zyasoft
Date 2015-04-26.23:36:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1430091364.92.0.034043471947.issue2343@psf.upfronthosting.co.za>
In-reply-to
Content
Unfortunately PYTHONPATH is no longer available, since it was reset by the launcher due to the issues with PyInstaller. Your best bet may be to simply directly execute the result of calling bin\jython --print. So my Windows VM, this looks like:

C:\jython2.7rc3>bin\jython --print
"C:\Program Files\Java\jdk1.7.0_55\bin\java" -Xmx512m -Xss1024k -classpath C:\jython2.7rc3\jython.jar;. -Dpython.home=C:\jython2.7rc3 -Dpython.executable=C:\jython2.7rc3\bin\jython.exe -Dpython.launcher.uname=windows -Dpython.launcher.tty=true org.python.util.jython

You can even directly execute this on the command line, using an appropriate somewhat familiar to standard shell programming on Unix-like systems (see http://stackoverflow.com/a/108511). First, let's set up the PYTHONPATH:

C:\jython2.7rc3>set PYTHONPATH=foo

Then try out:

C:\jython2.7rc3>for /f "delims=" %i in ('bin\jython --print') do set call_jython=%i
C:\jython2.7rc3>call %call_jython% -c "import os; print os.environ['PYTHONPATH']"
foo

It's possible to put this extra level of indirection in a minimal jython.bat that also calls the args. Here's my first attempt at such a wrapper script, which is likely to have errors, since I have never written a Windows batch script before:

@echo off
for /f "delims=" %%i in ('%~f0\..\jython.exe --print') do call %%i %*

(thanks to http://stackoverflow.com/questions/17063947/get-current-batchfile-directory)

However, you have to explicitly call it jython.bat (or name of your choice), since I don't think you can simply rename jython.exe to get it out of its way, due to how other installed scripts like pip.exe will bind jython.exe. Still it does seem to work:

C:\jython2.7rc3>bin\jython.bat -c "import os; print os.environ['PYTHONPATH']"
foo
History
Date User Action Args
2015-04-26 23:36:04zyasoftsetmessageid: <1430091364.92.0.034043471947.issue2343@psf.upfronthosting.co.za>
2015-04-26 23:36:04zyasoftsetrecipients: + zyasoft, pekka.klarck
2015-04-26 23:36:04zyasoftlinkissue2343 messages
2015-04-26 23:36:04zyasoftcreate