You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ScriptEngineManager mgr = new ScriptEngineManager();
final String script = "print __file__\n";
for (int i=0; i<5; i++) {
ScriptEngine pyEngine = mgr.getEngineByName("jython");
pyEngine.put(ScriptEngine.FILENAME, "hello" + i +".py");
pyEngine.eval(script);
}
On any execution after the first I get errors with __file__ being undefined. This does not happen if I use a single ScriptEngine instance, or if each instance runs in a separate thread.
Hello,
When I run this code:
On any execution after the first I get errors with
__file__
being undefined. This does not happen if I use a singleScriptEngine
instance, or if each instance runs in a separate thread.I can see that the interpreter gets the
__file__
value appropriately, but then it is lost here.Is there a contract that would explain this behavior or is it a bug?
The text was updated successfully, but these errors were encountered: