在Java中将对象对象转换为Jython中的pyobject对象

时间:2019-12-31 03:46:44

标签: java

将Java中的对象对象转换为Jython中的pyobject对象。尝试直接投放,但报告错误

package test;
import entity.Interpreter;
import org.python.core.PyFunction;
import org.python.core.PyObject;
import org.python.core.PyType;
public class test {
    public static void main(String[] args) {
        Interpreter interpreter = new Interpreter();
        interpreter.interpreter.execfile("tests.py");
        PyFunction pyFunction = interpreter.interpreter.get("test", PyFunction.class);

        Object object = new Object();
        PyObject pyObject = new PyObject((PyType) object);

        PyObject pyObject2 = pyFunction.__call__(pyObject);
        System.out.println(pyObject2);
    }
}

0 个答案:

没有答案