From: Robert W. B. <rb...@di...> - 2001-10-18 03:18:10
|
Hello Hubert, On Wed, 17 Oct 2001, Hubert Yoshizaki wrote: <snip> > still having problems... > > tried the 'import tryJythonSample'=A0 (without using the jythonc --pack= age > option) > > Exception in thread "main" java.lang.NullPointerException > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PyJavaClass.lookup(PyJavaClass= .java:39) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PyObject.<init>(PyObject.java:= 46) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PySingleton.<init>(PySingleton= .java:8) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PyNone.<init>(PyNone.java:7) > =A0=A0=A0=A0=A0=A0=A0 at > org.python.core.PySystemState.initStaticFields(PySystemState.java:341 > ) > =A0=A0=A0=A0=A0=A0=A0 at > org.python.core.PySystemState.initialize(PySystemState.java:320) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.Py.initProperties(Py.java:665) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.Py.initProxy(Py.java:709) > =A0=A0=A0=A0=A0=A0=A0 at tryJythonSample.<init>(tryJythonSample.java:10= 5) > =A0=A0=A0=A0=A0=A0=A0 at tryJythonMain.main(tryJythonMain.java:8) > > tried the 'import tryJythonSample.* when using the jythonc --package > option. > got the error > > C:\Hubert\Work\Projects\tryJython\tryJythonProject>java tryJythonMain > Exception in thread "main" java.lang.NullPointerException > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PyJavaClass.lookup(PyJavaClass= .java:39) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PyObject.<init>(PyObject.java:= 46) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PySingleton.<init>(PySingleton= .java:8) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.PyNone.<init>(PyNone.java:7) > =A0=A0=A0=A0=A0=A0=A0 at > org.python.core.PySystemState.initStaticFields(PySystemState.java:341 > ) > =A0=A0=A0=A0=A0=A0=A0 at > org.python.core.PySystemState.initialize(PySystemState.java:320) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.Py.initProperties(Py.java:665) > =A0=A0=A0=A0=A0=A0=A0 at org.python.core.Py.initProxy(Py.java:709) > =A0=A0=A0=A0=A0=A0=A0 at > tryJythonSample.tryJythonSample.<init>(tryJythonSample.java:107) > =A0=A0=A0=A0=A0=A0=A0 at tryJythonMain.main(tryJythonMain.java:8) > > > error wise, unless I'm mistaken, it seems to be running into the same > problem each time > Any ideas? > > Hubert I'm not sure this helps, but the code you list below works fine for me (linux+sunJDK1.3). One thing that might be worth checking is whether the tryJythonSample class actually exists in a file called "tryJythonSample.py". The matching classname/filename is required here, and a difference in those names makes a NPE like you are seeing. If that's no help, check back again :) -robert > (for others, here's the code...) > > import org.python.core.*; > import tryJythonSample; > > public class tryJythonMain > { > public static void main(String[] args) > { > tryJythonSample jySample =3D new tryJythonSample(); > jySample.makeObject(); > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 > } > } > > import java > class tryJythonSample(java.lang.Object): > =A0=A0=A0=A0=A0=A0=A0 def __init__(self): > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "@sig public tryJythonSample()" > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 print "Constructor for tryJythonSampl= e" > =A0=A0=A0=A0=A0=A0=A0 def makeObject(self): > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "@sig public void makeObject()" > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 print "I have just called a python me= thod!!" > > > _______________________________________________ Jython-users mailing li= st > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |