InteractiveConsole History on Linux
Robert Kern
robert.kern at gmail.com
Sun Jul 16 00:45:59 EDT 2006
Chris Spencer wrote:
> Robert Kern wrote:
>> Chris Spencer wrote:
>>> Why does code.InteractiveConsole support command history on Windows,
>>> but not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not
>>> support history at all, and the Windows console is implementing it's
>>> own? Is there any way to get command history working with
>>> InteractiveConsole on Linux?
>> Be sure that the readline module is installed.
>
> Yeah, "import readline" works just fine. My problem isn't hard to
> replicate. Can anyone else on Linux get command history to work with the
> following code? Note, it should be saved and run from a file.
>
> from code import InteractiveConsole
> i = InteractiveConsole(globals())
> i.interact()
You will also have to make sure that you import readline, too. This works for me:
import readline
from code import InteractiveConsole
i = InteractiveConsole(globals())
i.interact()
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list