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 InteractiveConsole

    java.lang.Object
      |
      +--org.python.util.PythonInterpreter
            |
            +--org.python.util.InteractiveInterpreter
                  |
                  +--org.python.util.InteractiveConsole

Direct Known Subclasses:
  ReadlineConsole

public class InteractiveConsole
extends InteractiveInterpreter

Field Summary
`java.lang.String` | `filename`

Fields inherited from class org.python.util.InteractiveInterpreter
`buffer`

Constructor Summary
`InteractiveConsole()`
`InteractiveConsole(PyObject locals)`
`InteractiveConsole(PyObject locals, java.lang.String filename)`

Method Summary
`static java.lang.String` | `getDefaultBanner()`
`void` | `interact()` Closely emulate the interactive Python console.
`void` | `interact(java.lang.String banner)`
`boolean` | `push(java.lang.String line)` Push a line to the interpreter.
`java.lang.String` | `raw_input(PyObject prompt)` Write a prompt and read a line.

Methods inherited from class org.python.util.InteractiveInterpreter
`interrupt, resetbuffer, runcode, runsource, runsource, runsource, showexception, write`

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

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

Field Detail

### filename

    public java.lang.String filename

Constructor Detail

### InteractiveConsole

    public InteractiveConsole()

### InteractiveConsole

    public InteractiveConsole(PyObject locals)

### InteractiveConsole

    public InteractiveConsole(PyObject locals,
                              java.lang.String filename)

Method Detail

### interact

    public void interact()

  Closely emulate the interactive Python console. The optional banner argument specifies the banner to print before the first interaction; by default it prints a banner similar to the one printed by the real Python interpreter, followed by the current class name in parentheses (so as not to confuse this with the real interpreter -- since it's so close!).

### getDefaultBanner

    public static java.lang.String getDefaultBanner()

### interact

    public void interact(java.lang.String banner)

### push

    public boolean push(java.lang.String line)

  Push a line to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's runsource() method is called with the concatenated contents of the buffer as source. If this indicates that the command was executed or invalid, the buffer is reset; otherwise, the command is incomplete, and the buffer is left as it was after the line was appended. The return value is 1 if more input is required, 0 if the line was dealt with in some way (this is the same as runsource()).

### raw_input

    public java.lang.String raw_input(PyObject prompt)

  Write a prompt and read a line. The returned line does not include the trailing newline. When the user enters the EOF key sequence, EOFError is raised. The base implementation uses the built-in function raw_input(); a subclass may replace this with a different implementation.

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