InteractiveInterpreter (Jython API documentation)
Date: 2012-08-13

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.python.util
Class InteractiveInterpreter

    java.lang.Object
      org.python.util.PythonInterpreter
          org.python.util.InteractiveInterpreter

Direct Known Subclasses:
  InteractiveConsole

    public class InteractiveInterpreter

extends PythonInterpreter

Field Summary
`StringBuffer` | `buffer`
`String` | `filename`

Constructor Summary
`InteractiveInterpreter()`
`InteractiveInterpreter(PyObject locals)`
`InteractiveInterpreter(PyObject locals, PySystemState systemState)`

Method Summary
`void` | `interrupt(ThreadState ts)` Pause the current code, sneak an exception raiser into sys.trace_func, and then continue the code hoping that Jython will get control to do the break;
`void` | `resetbuffer()`
`void` | `runcode(PyObject code)` execute a code object.
`boolean` | `runsource(String source)` Compile and run some source in the interpreter.
`boolean` | `runsource(String source, String filename)`
`boolean` | `runsource(String source, String filename, CompileMode kind)`
`void` | `showexception(PyException exc)`
`void` | `write(String data)`

Methods inherited from class org.python.util.PythonInterpreter
`cleanup, compile, compile, compile, compile, eval, eval, exec, exec, execfile, execfile, execfile, get, get, getLocals, getSystemState, initialize, set, set, setErr, setErr, setErr, setIn, setIn, setIn, setLocals, setOut, setOut, setOut, threadLocalStateInterpreter`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### buffer

    public StringBuffer buffer

### filename

    public String filename

Constructor Detail

### InteractiveInterpreter

    public InteractiveInterpreter()

### InteractiveInterpreter

    public InteractiveInterpreter(PyObject locals)

### InteractiveInterpreter

    public InteractiveInterpreter(PyObject locals,
                                  PySystemState systemState)

Method Detail

### runsource

    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.

### runsource

    public boolean runsource(String source,
                             String filename)

### runsource

    public boolean runsource(String source,
                             String filename,
                             CompileMode kind)

### runcode

    public void runcode(PyObject code)

  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.

### showexception

    public void showexception(PyException exc)

### write

    public void write(String data)

### resetbuffer

    public void resetbuffer()

### interrupt

    public void interrupt(ThreadState ts)

  Pause the current code, sneak an exception raiser into sys.trace_func, and then continue the code hoping that Jython will get control to do the break;

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Jython homepage