alibaba / pemja

Apache License 2.0
90 stars 25 forks source link

Failed to find the function after exec #26

Open syntomic opened 1 year ago

syntomic commented 1 year ago

I define a function by exec, but invoke this function failed, eg:

interpreter.exec("def f(a):return a");
interpreter.invoke("f", 1);

then throw:

Exception in thread "main" pemja.core.PythonException: <class 'RuntimeError'>: Failed to find the function `f` 
        at pemja.core.PythonInterpreter.invokeOneArgInt(Native Method)
        at pemja.core.PythonInterpreter.invokeOneArg(PythonInterpreter.java:184)
        at pemja.core.PythonInterpreter.invoke(PythonInterpreter.java:93)
HuangXingBo commented 1 year ago

Thanks a lot for the report. I will take a look.