InteractiveConsole History on Linux

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


skip at pobox.com wrote:
>     Chris> Yeah, "import readline" works just fine. My problem isn't hard to
>     Chris> replicate. Can anyone else on Linux get command history to work
>     Chris> with the following code? Note, it should be saved and run from a
>     Chris> file.
> 
> Command history across sessions or just command recall from the current
> session?  On my Mac your script works just fine for me (no import readline
> as Robert Kern indicated in his reply) to do command recall from the the
> current session, but more is needed if you expect to get command history
> across sessions.

I was just looking for recall in the current session, although the 
stdlib docs have an example of recall across sessions ( 
http://docs.python.org/lib/readline-example.html ).

On Linux, it seems you have to explicitly import readline in order to 
get command history, although my application was also redirecting 
sys.stdout, which was also causing problems.



More information about the Python-list mailing list