Python shell: Arrow keys not working in PuTTY

Tim Chase python.list at tim.thechases.com
Mon Feb 23 09:33:47 EST 2015


On 2015-02-23 13:44, David Aldrich wrote:
> I want to use the Python 3.4 interpreter interactively, via a PuTTY
> ssh session.  Python is running on Centos 5.
> 
> Currently, the arrow keys do not work:
[snip]
> sudo apt-get install libreadline-dev
> 
> followed by a rebuild of Python
> 
> or
> 
> pip install readline
> 
> Please can anyone comment on the easiest way to fix this?  Is a
> rebuild of Python necessary?

Depends on what you consider "easier".  If you install readline, but
don't want to rebuild Python, you could also try installing the
rlwrap program and then invoking Python with that:

  bash$ rlwrap python

which should intercept the inputs and handle them with some nice
readline capabilities.

Otherwise, just make sure that Python builds with readline support as
you've read elsewhere.

-tkc

PS: and you mention being on CentOS but running apt-get.  I believe
CentOS and other Red-Hat based distros use "yum" instead of "apt-get"







More information about the Python-list mailing list