Package Products :: Package ZenModel :: Module zendmd :: Class HistoryConsole
[hide private]
[frames] | no frames]

Class HistoryConsole

source code

code.InteractiveInterpreter --+    
                              |    
        code.InteractiveConsole --+
                                  |
                                 HistoryConsole

Subclass the default InteractiveConsole to get readline history

Instance Methods [hide private]
 
__init__(self, locals=None, filename="<console>", histfile=zenPath('.pyhistory'))
Constructor.
source code
 
init_history(self, histfile) source code
 
save_history(self, histfile) source code
 
raw_input(self, prompt="")
Write a prompt and read a line.
source code
 
runsource(self, source, filename)
Compile and run some source in the interpreter.
source code

Inherited from code.InteractiveConsole: interact, push, resetbuffer

Inherited from code.InteractiveInterpreter: runcode, showsyntaxerror, showtraceback, write

Method Details [hide private]

__init__(self, locals=None, filename="<console>", histfile=zenPath('.pyhistory'))
(Constructor)

source code 

Constructor.

The optional locals argument will be passed to the InteractiveInterpreter base class.

The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks.

Overrides: code.InteractiveInterpreter.__init__
(inherited documentation)

raw_input(self, prompt="")

source code 

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.

Overrides: code.InteractiveConsole.raw_input
(inherited documentation)

runsource(self, source, filename)

source code 

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 True in case 2, False 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.

Overrides: code.InteractiveInterpreter.runsource
(inherited documentation)