package jep.testing;
import jep.Jep;
import jep.JepException;
public class Main {
public static void main(String[] args) {
try(Jep jep = new Jep(false, "<path to multiplier.py>"))
{
jep.eval("import multiplier");
jep.eval("result = multiplier.multiply(2)");
Object result = jep.getValue("result");
System.out.println("Result from eval: " + result);
jep.runScript("multiplier.py");
Object ret = jep.invoke("multiply", 2);
System.out.println("Result from runscript and invoke: " + ret);
} catch (JepException e) {
e.printStackTrace();
}
}
}
multiplier.py is at the same location where the java program is ran so no need to give the full path (or is there?)
When I run this I get the following output:
Result from eval: 4
Process finished with exit code -1073740777 (0xC0000417)
You can see the eval version is working fine but the runscript version seems to not do anything for a while and then I get the exit code.
Is there something I am doing wrong?
Any help you can provide would be greatly appreciated.
Also what is the syntax for invoking a method in a class using the runscript example? i.e. if the multiply method was in a class called Multiplier?
Regards,
Mike