From: John Y. <wo...@ec...> - 2002-02-10 06:26:29
|
Thanks for that, but.... I think the line: interp.exec("MyObject = MyClass()"); is causing the following exception: java.lang.IllegalAccessException: Class org.python.core.PyReflectedConstructor can not access a member of class MyClass with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57) at java.lang.reflect.Constructor.newInstance(Constructor.java:268) at org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java) at org.python.core.PyJavaInstance.__init__(PyJavaInstance.java) at org.python.core.PyJavaClass.__call__(PyJavaClass.java) at org.python.core.PyObject.__call__(PyObject.java) at org.python.pycode._pyx2.f$0(<string>:1) at org.python.pycode._pyx2.call_function(<string>) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyCode.call(PyCode.java) at org.python.core.Py.runCode(Py.java) at org.python.core.Py.exec(Py.java) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java) at SimpleEmbedded.main(SimpleEmbedded.java:19) java.lang.IllegalAccessException: java.lang.IllegalAccessException: Class org.python.core.PyReflectedConstructor can not access a member of class MyClass with modifiers "public" At the moment, MyClass is just: class MyClass { public MyClass(){} } (MyClass is defined in SimpleEmbedded.java too) The exception seems to say that I can't access the constructor because it is public, yet if I take it out... it says it can't find a public constructor. Also, will the following work, if I want a python MyClass object to access the data in a java MyClass object? MyClass AnObject = new MyClass(); interp.exec("import MyClass"); interp.exec("MyObject = MyClass()"); interp.set("MyObject", AnObject); Any suggestions? |