From: Hubert Y. <yos...@da...> - 2001-10-16 23:16:49
|
<html> Hi,<br> I'm just experimenting with jythonc (new to Python/Jython and not really experienced in Java either for that matter) and came up with this problem.<br> <br> My python test code is simply this:<br> <br> <font color="#0000FF"><i>import java<br> class tryJythonSample(java.lang.Object):<br> def __init__(self):<br> "@sig public tryJython()"<br> print "Constructor for tryJython"<br> def makeObject(self):<br> "@sig public void makeObject()"<br> print "I have just called a python method!!"<br> <br> </font></i><font color="#000000">after doing a jythonc tryJythonSample.py and get the corresponding class files and java file I created a java file that calls the methods.<br> My java file.<br> <br> </font><font color="#0000FF"><i>import tryJythonSample.*;<br> import org.python.core.*;<br> <br> public class tryJythonMain<br> {<br> public static void main(String[] args)<br> {<br> tryJythonSample jySample = new tryJythonSample();<br> jySample.makeObject();<br> <br> }<br> } </font></i><font color="#000000"> <br> <br> when I run my java file (tryJythonMain) I get the following:<br> <br> </font><font color="#0000FF"><i>Exception in thread "main" java.lang.NullPointerException<br> at org.python.core.PyJavaClass.lookup(PyJavaClass.java:39)<br> at org.python.core.PyObject.<init>(PyObject.java:46)<br> at org.python.core.PySingleton.<init>(PySingleton.java:8)<br> at org.python.core.PyNone.<init>(PyNone.java:7)<br> at org.python.core.PySystemState.initStaticFields(PySystemState.java:341<br> )<br> at org.python.core.PySystemState.initialize(PySystemState.java:320)<br> at org.python.core.Py.initProperties(Py.java:665)<br> at org.python.core.Py.initProxy(Py.java:709)<br> at tryJythonSample.<init>(tryJythonSample.java:105)<br> at tryJythonMain.main(tryJythonMain.java:9)<br> <br> </font></i><font color="#000000">Can anyone tell me what I'm doing wrong?<br> Is there a problem with dependencies?<br> Or is it something really dumb and simple that tells me I'm simply too tired to think properly? <br> Any help would be greatly appreciated.<br> Thanks,<br> Hubert</font> <BR> </html> |