From: Jeff A. <ja...@fa...> - 2019-06-27 08:43:13
|
Hi Евгений: sys.argv is a bridge from the command line to your code. If you want it to appear that arguments come from a command line, you can assign/append to it. Just going by the docs and code, one way is to assign the attribute named by ScriptEngine.ARGV in the ScriptContext of the engine. If it exists, this gets copied as sys.argv on every eval(). (This seems a slightly odd design to me. Why not once at engine creation?) Jeff Allen On 27/06/2019 07:31, Евгений Король wrote: > Hello. How to pass arguments from Java args to jython using JSR-223? > For example when i use code like this: > > ScriptEngine engine = new ScriptEngineManager().getEngineByName("python"); > > // Using the eval() method on the engine causes a direct > // interpretataion and execution of the code string passed into it > engine.eval("import sys"); > > How can i pass args to Jython? > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |