views:

130

answers:

3

I'm running the Python CLI under Linux:

bla:visualization> python
Python 2.1.1 (#18, Nov  1 2001, 11:15:13) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>>

For some reason the arrow keys and the delete key don't work:

delete:

>>> x^H^H^H

up arrow:

>>> x^[[A^[[A

etc...

How can I make these work?

+3  A: 

Install iPython ( http://ipython.scipy.org/ but can be installed using easy_install or pip), it is much much better than the default CLI.

juanjux
+3  A: 

Try setting your terminal from the shell, with stty. Pay special attention to the special characters erase and kill. Your Python installation is 8 years old, consider updating to a newer version.

gimel
+5  A: 

The basic problem is that your Python installation was likely not compiled with the readline library. You can confirm this by trying to import the readline module:

import readline

You should get an error when you import if readline is not present.

If this is the case, there's not much you can do other than recompile Python with the readline library, if you can.

Pinochle