Arrow keys in Putty returning ^[[A ^[[D ^[[B instead of moving the cursor
PythonPuttyArrow KeysPython Problem Overview
Has anyone else ever had this error in PuTTy?
For example, pressing the Up Key now produces:
>>> ^[[A
Google doesn't let you search for special characters so I'm stumped at finding existing version of this problem.
EDIT:
So this happened after I pasted in some unicode (when, I think, the translation was already set to utf-8).
I've checked the Change Settings dialog box for different settings than my other open PuTTy windows, but the settings appear to be identical.
EDIT2:
This is fixed by restarting PuTTy, but still a nuisance.
EDIT3:
How to replicate the exact same bug:
- Open a putty terminal to a linux PC (I'm using RedHat)
- Open Python 2.7.* - using the command
python2.7
(note: error does not appear in 2.6) import codecs
- Now use the arrow keys, and these bizarre characters appear.
Python Solutions
Solution 1 - Python
In my experience that's because "bash" is not running. Simply run "/bin/bash" to enjoy colors, history and more.
Solution 2 - Python
I've found that specifying "The Function Keys and Keypad" option to match your operating system resolves many issues.
[Putty]
Terminal -> Keyboard --> RadioButton "Linux"
(if you're using Linux) and then you can start your session
Solution 3 - Python
You could try changing the 'Application Cursor Keys' mode. It's in the Terminal->Keyboard subsection of the initial configuration window (these settings may potenitally be overridden by your server).
http://the.earth.li/~sgtatham/putty/0.55/htmldoc/Chapter4.html#S4.4.4
Solution 4 - Python
Just run the simple bash command or sudo bash in ssh. It usually works.
Solution 5 - Python
For those interested in the issue, had same simptoms in a virtualenvironment, resolved the issue with
pip install readlines
See following answer for details.
Solution 6 - Python
Terminal >>> Local line editing >>> Force off