Command history in python shell under linux

Jochen Küpper jochen at jochen-kuepper.de
Thu May 2 00:47:47 EDT 2002


On Wed, 01 May 2002 23:01:27 -0500 Stephen Boulet wrote:

Stephen> When I hit the up arrow in the python shell, I get:

Stephen> ^[[A

Stephen> How do I set up things so that I get the previous command? Thanks.

>From my
,----[~/.pythonrc.py]
| # readline
| try:
|     import readline
| except ImportError:
|     print "Module readline not available."
| else:
|     import rlcompleter
|     readline.parse_and_bind("tab: complete")
|     
|     import os
|     histfile = os.path.join(os.environ["HOME"], ".python_history")
|     try:
|         readline.read_history_file(histfile)
|     except IOError:
|         pass
|     import atexit
|     atexit.register(readline.write_history_file, histfile)
|     del os, histfile
`----

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: 44BCCD8E
        Sex, drugs and rock-n-roll



More information about the Python-list mailing list