InteractiveConsole History on Linux

Chris Spencer usenet.20.evilspam at spamgourmet.com
Sun Jul 16 02:11:23 EDT 2006


Robert Kern wrote:
> 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()

Actually, it seems redirecting sys.stdout for my logger was the issue. 
Thanks for your help though.

Chris



More information about the Python-list mailing list