-> Hi, perhaps you can help. As a python and jython newbie I am trying to
-> embed some jython code into my java program. Seems an easy way to do this
-> is by creating a PythonInterpreter object. So far, so good. My problem
-> arises when I attempt a conditional statement such as:
->
-> String erpFormula = ( "if ( 10 * math.log10( TransmitPower ) > 10 and
-> LineLoss + RadomeLoss > 6 ): resultant = 20; else: resultant = 10" );
->
-> PythonInterpreter interp = new PythonInterpreter();
-> interp.exec( erpFormula );
->
-> The runtime error is: Syntax error: invalid syntax. Evidentally it chokes on
-> the else keyword.
->
-> If I remove the else..., it runs correctly.
The above statement isn't valid in (C)Python, either; I'd suggest you create
a multiline string. I'm not sure how to fit the 'else' statement in on the
end of a single line...
--titus
|