|
From: Brian L. (EEI) <Bri...@ee...> - 2001-10-08 14:58:27
|
Hi,
I sent the following email to you on 2nd Febuary 2001. I have not
got an answer back.
regards/Brian
-------------------------------------------------------
I'm using Jython from a PC and Window NT. I do not run Jython from the command Shell I'm importing the following classes in order to run Jython scripts:
PythonInterpreter;
InteractiveInterpreter;
InteractiveConsole
I'm reading in the Jython script, it is read line by line using the following:
:
while ((inputLine = in.readLine()) != null){
taskText += (inputLine + "\n");
:
The Jython file is executed, line by line via the interpreter using the method runsource().
I'm experiencing a problem with IF and WHILE statements. The interpreter does not like the symbol "\n". Obviously there is other symbols to show that a jython line is associated with the IF statement. Also there is probably a symbol which indicates that if/while statement has ended. Can you tell me the end of line symbols that are associated with IF/While statements.
Here are two scripts I ran with my Java program, the output is shown below. I also ran the following 2 scripts with Jython on the command shell and they worked ok:
class example:
x = int(1)
y = int(1)
while x < 5 :
x = x + 1
print x
output = 2 but should be 5.
class example:
x = int(1)
y = int(2)
if x == y :
print 'X and Y have the same value'
else :
print 'X and Y are different'
output = X and Y have the same value
X and Y are different
Also the following syntax error is outputted.
Traceback (innermost last):
(no code object) at line 0
File "<input>", line 1
else :
^
SyntaxError: invalid syntax
thanks/Brian
|