Jython Listed By `getenginefactories`, But `getenginebyname("jython")` Is `null`
Solution 1:
Here is one workaround:
Add this at the top:
import org.python.core.Options;
Before invoking getEngineByName
, set
Options.importSite = false;
Then the engine is created without problems.
Got the solution from this conversation.
Another solution that works well (proposed by mzjn in the comments) is to replace the jython
artifact by jython-standalone
.
Solution 2:
You either need to disable importSite
with python Options, as you already discovered. Or, set the python.home
to where you have extracted jython
. I have it extracted in my home folder under jython2.7.0
; adding this,
System.setProperty("python.home", newFile(
System.getProperty("user.home"), "jython2.7.0").getPath()
);
allows python to discover the correct PYPATH
so it can build the python environment.
Solution 3:
One way to fix this is to set the env var jythonpath
to include the specific Lib
directory you need for your instance (and include the Lib\site-packages
as well to avoid further issues with specific packages)
Post a Comment for "Jython Listed By `getenginefactories`, But `getenginebyname("jython")` Is `null`"