org.python.util
Class InteractiveInterpreter
public
class
InteractiveInterpreter
extends PythonInterpreter
public StringBuffer buffer
public String filename
public InteractiveInterpreter()
public InteractiveInterpreter(
PyObject locals)
Pause the current code, sneak an exception raiser into
sys.trace_func, and then continue the code hoping that JPython will
get control to do the break;
public void resetbuffer()
execute a code object.
When an exception occurs, self.showtraceback() is called to display
a traceback. All exceptions are caught except SystemExit, which is
reraised.
A note about KeyboardInterrupt: this exception may occur elsewhere
in this code, and may not always be caught. The caller should be
prepared to deal with it.
public boolean runsource(String source)
Compile and run some source in the interpreter.
Arguments are as for compile_command().
One several things can happen:
1) The input is incorrect; compile_command() raised an exception
(SyntaxError or OverflowError). A syntax traceback will be printed
by calling the showsyntaxerror() method.
2) The input is incomplete, and more input is required;
compile_command() returned None. Nothing happens.
3) The input is complete; compile_command() returned a code object.
The code is executed by calling self.runcode() (which also handles
run-time exceptions, except for SystemExit).
The return value is 1 in case 2, 0 in the other cases (unless an
exception is raised). The return value can be used to decide
whether to use sys.ps1 or sys.ps2 to prompt the next line.
public boolean runsource(String source, String filename)
public boolean runsource(String source, String filename, String symbol)
public void write(String data)