From: John E. C. <jc...@ve...> - 2001-03-22 22:38:44
|
Hi jython-users, While upgrading to Jython 2.0 from JPython 1.1, I have encountered a couple of comparability problems with my old working code and 2.0. Enclosed is a java file that demonstrates both problems. Problem #1. This code also throws a java.lang.NullPointerException at org.python.core.InternalTables.createInternalTables(InternalTables.java:44) If I uncomment the PySystemState.initialize(); line it will run. I don't need this in 1.1. Why now? Problem #2. This code will also (When first problem is not encountered) throw a Traceback (innermost last): File "<string>", line 7, in ? java.lang.NoSuchMethodError at org.python.core.MakeProxies.makeAdapter(MakeProxies.java:40)... If I remove the , 'actionPerformed=exit' from the JButton it will run. This error is not thrown in 1.1. (Note that these statements are pulled from the swing demo on the 2.0 Demo directory.) ---------------------------------------------------- package test.jython; import org.python.util.PythonInterpreter; import org.python.core.*; public class InterpreterTest { public static void main(String []args) throws PyException{ //PySystemState.initialize(); //#1 String s2= "from pawt import swing"+"\n"+ "import java"+"\n"+ "\n"+ "def exit(e): java.lang.System.exit(0)"+"\n"+ "\n"+ "frame = swing.JFrame('Swing Example', visible=1)"+"\n"+ "button = swing.JButton('Close Me!', actionPerformed=exit)"+"\n"+ //#2 "frame.contentPane.add(button)"+"\n"+ "frame.pack()" ; PythonInterpreter interp = new PythonInterpreter(); interp.exec(s2); } } ------- Appreciate any ideas, or workarounds anyone may know about. thanks - John |