New to Jpype - TypeError .... class is not callable

P

plovet

Hello,
I am trying to use jpype, but after several hours/days, I still cannot get
it to work.

I get a TypeError --- Package is not Callable error. (See below)

I already have done a good workable chunk of code I wrote in Java that
implements steam table calculations. After a few weeks of playing with
Python, I see that as much more promising for me, and want to switch. But
rewriting all of this java code a second time is not going to happen.

If I can get jpype to make this ONE link to my existing Java code for me, I
can move forward. I would appreciate any help as I can not find the answer
in my internet searches.

--------------------------------------------------------------------------
I get the following error (IDLE):
Traceback (most recent call last):
File "C:\Python26\testPype.py", line 16, in <module>
myClass = steamPackage.SteamPoint()
File "C:\Python26\lib\site-packages\jpype\_jpackage.py", line 53, in
__call__
raise TypeError, "Package "+self.__name+" is not Callable"
TypeError: Package de.engineering.steam.SteamPoint is not Callable

----------------------------------------------------------------
Here is my Python Code:
import jpype
jvmPath = "C:\\Program
Files\\Java\\jdk1.5.0_13\\jre\\bin\\client\\jvm.dll"
options = "-ea"
jarPath =
"-DJava.class.path=C:\\javaNetBeans\\Projects\\de.engineering.steam\\dist\\de.engineering.steam.jar"

jpype.startJVM(jvmPath,options, jarPath)

packageName="de.engineering.steam"
steamPackage = jpype.JPackage(packageName)

myClass = steamPackage.SteamPoint()

FYI, I have tried various variations that I could think of, but still no
luck
myClass = steamPackage.SteamPoint #produces no error, but I can do
nothing with this
myClass = steamPacakge.NonExistentClass #also produces no error, and
just as useless!
myClass = steamPackage.SteamPoint(1,40,400) # TypeError as above
myClass = steamPackage.SteamPoint.SteamPoint() # TypeError as above

---------------------------------------------------------------------
Here is a summary of the Java code for the class. This is stored in a .jar
file (see python code). As stated, this single Java class is the gateway to
all of my Java code stored in that jar file ... so all I need is to access
the functionality in this one class.

package de.engineering.steam;
import de.engineering.steam.IAPWSF97.*;

public class SteamPoint {

private double p, t, h, s, v, x;
///etc. etc.

//blank constructor - not important
public SteamPoint() {}

//the *real* constructer
public SteamPoint(int switchCode, double d1, double d2) {...}

//the methods I need to access after a sucessful construction creation

/**Returns the pressure (bara)*/
public double p() {return p;}


//etc.... etc... etc..
}

THANK YOU for any help!

Timothy (plovet)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top