Hello. I am using Jython 2.5.1 with JSR-223 (i.e. javax.script package) and I expect the last line of the Python script to be returned. For example, after evaluating this script:
class Multiplier:
def multiply(self, x, y):
return x * y
Multiplier().multiply(5, 7)
I should get back 35, but I get null instead. In other hand it works with this other test:
5 * 7
What am I doing wrong?
Here's the Java code:
public static void main(String[] args) throws Exception {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");
FileReader f = new FileReader("Multiplier.py");
Object result = engine.eval(f);
//assert(result == 35);
}
PS: It works fine with JRuby, Groovy and Rhino, i.e. the last line is always returned.
Thanks in advance.