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

plovet tr03 at jm.rinkleff.com
Mon Jan 17 17:30:10 EST 2011


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)


-- 
View this message in context: http://old.nabble.com/New-to-Jpype---TypeError-....-class-is-not-callable-tp30676235p30676235.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list