|
From: Jeff A. <ja...@fa...> - 2022-02-19 12:21:56
|
Hi Hartmut. Thanks for experimenting with solutions. I've never used coverage myself, but when I run jython (on Windows) it picks up the JVM on my path. I do not understand why, in your account of the error, coverage-script.py is in the Jython bin directory. I would expect that to be in site-packages, or somewhere of its own, and the paths to modules it needs would then be on the sys.path. The error about not being able to find a module does not scream "wrong JVM" to me. pkg_resources is in site-packages, as part of the pip installation we do. However, pip as a whole is broken for all versions of Jython thanks to changes at pypi.org and our slowness to adapt. pkg_resources is not necessarily affected. Running the jython.jar directly may not work well because additional JARs you may need are precluded by the -jar option. The jython.exe launcher has a --print command that tells you what it would have done, which is useful when you need to roll your own command line. --help will tell you which environment variables it pays attention to in creating that command. -- Jeff Allen On 15/02/2022 10:33, Niemann, Hartmut wrote: > > Hi! > > I need to specify which java is used for a coverage run. > > I am using Jython 2.7.0 and coverage 3.4.3 > > I used to use “coverage.exe” but how could I tell it which java to start? > > I succeded starting “jython.exe coverage-script.py” , but same > problem: which java VM is used? > > I can run Jython with an explicit JAVA executable and some simple example > > %JAVA64% -jar "somepath\jython.jar" %JYTHON_DIR%\bin\hello.py > > But when I combine these to > > %JAVA64% -jar "C:\SIBAS32\JAVA_LIBS\jython\jython.jar" > %JYTHON_DIR%\bin\coverage-script.py > > I get > > Traceback (most recent call last): > > File "C:\DEVTOOLS\Jython\2.7.0\bin\coverage-script.py", line 5, in > <module> > > from pkg_resources import load_entry_point > > ImportError: No module named pkg_resources > > So I would need to convince coverage.exe or jython.exe to use the > Java.exe I want, or teach java.exe -jar … coverage-script.py where to > look for the pkg_resources directory. > > On > > https://www.jython.org/jython-old-sites/archive/21/docs/interpreter.html > > I found the sentence > > “jythonis a short script that invokes your local JVM, [..]” > > which unfortunately does not tell me how the JVM is selected from the > (four?) JVMs I have installed. > > What would you recommend? > > Regards > > Hartmut > > |