From: Ype K. <yk...@xs...> - 2001-09-23 08:55:40
|
Jim, >>Can anyone send back with a solution to the problem contained in >>erpFormula2 referenced below?? It obviously stems from the "^" operator as erpFormula1 is identical except for the use of math.log10 versus "^". The runtime error I am getting is: >> >>TypeError: __xor__nor__rxor__ defined for these operands >> >>PythonInterpreter interp = new PythonInterpreter(); >>interp.set( "math", new ExtraMath() ); >>interp.exec( erpFormula2); >> >>String erpFormula1 = ("resultant = 10 * math.log10( TransmitPower)"); >>String erpFormula2 = ("resultant = 10 ^( TransmitPower )"); ^ is the xor operator in python, and __xor__ and __rxor__ are the functions that can implement it for either objects involved (the left and the right one respectively). Neither 10 or TransmitPower has such a method defined. You might try and use the built in pow() function http://www.python.org/doc/current/lib/built-in-funcs.html >>Also as I am new to jython, what is the deal with the __xxxx__ method See above. >>calls?? I tried to subclass a PyFloat object to a java Double object using something like: >>Double newDouble = result.__tojava__( new Double( 0.0 ) ) without success. >>The leading and trailing underscores are a bit different. I'm afraid I miss the point here. >>thanks to any and all who respond....Jim. My pleasure, Ype |