Problems with InteractiveInterpreter

Marcel Lanz marcel.lanz at isoe.ch
Sat Apr 10 12:47:58 EDT 1999


Hi,

I have a modified python shell and I would use processing python code
with the InteractiveInterpreter class.
Now, I've got the following error, if I try to run some codelines with
this Interpreter:

Output:
---------------------------------------------
lanzm at frodo:~/data/projects/pylip > python interp.py 
  File "<input>", line 1
    print i
    ^
SyntaxError: invalid syntax
---------------------------------------------
interp.py:
---------------------------------------------
from code import InteractiveInterpreter

lines = open('test2.py', 'r').readlines()

ii = InteractiveInterpreter()
for line in lines:
 ii.runsource(line)
---------------------------------------------
test2.py:
---------------------------------------------
#!/usr/local/bin/python
#
# test, marcel.lanz at gmx.net
#
# --------------
# File: $Source$
# --------------
# $Log$
#

for i in 'hello':
 print i
----------------------------------------------

any ideas?

marcel




More information about the Python-list mailing list