jython getting started question

2021-06-11 Thread Steve Pruitt via Python-list
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 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://mail.python.org/mailman/listinfo/python-list


Re: jython getting started question

2021-06-11 Thread Steve Pruitt via Python-list
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  on 
behalf of Steve Pruitt via Python-list 
Sent: Friday, June 11, 2021 9:24 AM
To: [email protected] 
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 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$
-- 
https://mail.python.org/mailman/listinfo/python-list