Keyboard problems with Python shell over SSH

  • Thread starter Nils Emil P. Larsen
  • Start date
N

Nils Emil P. Larsen

Hello

I'm not sure this is Python-related but it might be since Bash and vim
works perfectly.

I connect to my server using SSH and then run 'python' to enter the
shell. I can't use the arrow buttons (up, down, left and right).
Instead I get this ^[[A , ^[[B, ^[[C or ^[[D.

How do I get my arrow buttons to work?

Sorry if this is offtopic.

Nils Emil P. Larsen
 
S

Stian Soiland

På 23. jan 2005 kl. 21:55 skrev Nils Emil P.Larsen:
I connect to my server using SSH and then run 'python' to enter the
shell. I can't use the arrow buttons (up, down, left and right).
Instead I get this ^[[A , ^[[B, ^[[C or ^[[D.

Your Python installation is probably compiled without readline support.
It is the readline library that enables arrow keys and Ctrl-R and stuff
to work.

Try "import readline" - you will probably get an error.

I won't go into detail on how to install readline on your OS. In
Linuxes, it might be apt-get install readline-dev. In other OSes,
different licensing and packaging issues might have prevented
readline's precense.


-- --
Stian Søiland You can't say civilization don't
Trondheim, Norway advance, however, for in every war
http://www.soiland.no/ they kill you in a new way. [Rogers]
=/\=
 
N

Nils Emil P. Larsen

Hello Stian
Your Python installation is probably compiled without readline support.
It is the readline library that enables arrow keys and Ctrl-R and stuff
to work.
Try "import readline" - you will probably get an error.

You are indeed right. "import readline" generated an error.

I downloaded, compiled and installed GNU readline.
Then I downloaded Python 2.4 source and configured it with
../configure --with-readline
make
make install

This did the trick!
Thank you!

Nils Emil P. Larsen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top