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
the __file__ variable will either: a) be set appropriately if this is the first time the script was run on a particular thread, or b) be unset, causing the script to fail.
The ScriptModule passes the file name to the engine. In Jython, this file name gets picked up in the PyScriptEngine. In the pathological case, this __file__ value is lost here
This does not seem to be a core problem with the interpreter, e.g. reuse of an existing interpreter within a thread produces appropriate output:
However, in our case, a new ScriptEngine instance (and interpreter instance) is created for each execution, whether it's within the same thread or not. If we modify the previous script to do the same, we can reproduce the error:
Given the following script:
the
__file__
variable will either: a) be set appropriately if this is the first time the script was run on a particular thread, or b) be unset, causing the script to fail.The ScriptModule passes the file name to the engine. In Jython, this file name gets picked up in the PyScriptEngine. In the pathological case, this
__file__
value is lost hereThis does not seem to be a core problem with the interpreter, e.g. reuse of an existing interpreter within a thread produces appropriate output:
However, in our case, a new
ScriptEngine
instance (andinterpreter
instance) is created for each execution, whether it's within the same thread or not. If we modify the previous script to do the same, we can reproduce the error:So this is either a bug in jython, or a misuse of the script engine on our part.
The text was updated successfully, but these errors were encountered: