jython getting started question

Steve Pruitt bpruitt at opentext.com
Fri Jun 11 12:34:32 EDT 2021


Finally found the solution

Options.importSite = false;

which solved my issue.

I can't set Bindings and pass args to script.  The only example I found is for JavaScript.  I think maybe it doesn't work for jython.

Thanks
________________________________
From: Python-list <python-list-bounces+bpruitt=opentext.com at python.org> on behalf of Steve Pruitt via Python-list <python-list at python.org>
Sent: Friday, June 11, 2021 9:24 AM
To: python-list at python.org <python-list at python.org>
Subject: [EXTERNAL] - jython getting started question

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. If you feel that the email is suspicious, please report it using PhishAlarm.


Not sure if this is the right list for jython questions.

I am getting started with both python and jython.  My use case need is invoking python from java.  org.python:jython:2.7.2 loaded ok.

To check, I executed the following.

ScriptEngineManager manager = new ScriptEngineManager();
List<ScriptEngineFactory> engines = manager.getEngineFactories();

Engine name: Oracle Nashorn
Version: 1.8.0_242
Language: ECMAScript
Short Names:
nashorn
Nashorn
js
JS
JavaScript
javascript
ECMAScript
ecmascript
Engine name: jython
Version: 2.7.2
Language: python
Short Names:
python
jython

The output looks like I have two engines:  Oracle Nashorn and jython (the one I need).  But when, I try:

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jython");

engine is null.  I tried the python short name and got a null engine too.

Thanks.
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Obbck6kTJA!OfpEEVqhd12SZnOn5z54YO293doFSUn7b0oSkx11CgsDEFXZNFbK1pjNDo4VS4F4$


More information about the Python-list mailing list