471,349 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Getting the arrow keys to work properly in Python

Motoma
3,237 Expert 2GB
When I use the python interpreter on my remote machine, the arrow keys do not function properly. Instead of repositioning the cursor and recalling previous commands, I get ^[[A ^[[B ^[[C ^[[D written to the screen.
Is there a way I can bind these to the appropriate actions, or is this happening because of a misconfiguration elsewhere?
Jul 10 '07 #1
7 3225
bartonc
6,596 Expert 4TB
When I use the python interpreter on my remote machine, the arrow keys do not function properly. Instead of repositioning the cursor and recalling previous commands, I get ^[[A ^[[B ^[[C ^[[D written to the screen.
Is there a way I can bind these to the appropriate actions, or is this happening because of a misconfiguration elsewhere?
Hey, Motoma. Will you remind me of you OS environment, please.
Jul 10 '07 #2
Motoma
3,237 Expert 2GB
Hey, Motoma. Will you remind me of you OS environment, please.
Oops, sorry guys, I am running this on Linux :P
Jul 10 '07 #3
bartonc
6,596 Expert 4TB
When I use the python interpreter on my remote machine, the arrow keys do not function properly. Instead of repositioning the cursor and recalling previous commands, I get ^[[A ^[[B ^[[C ^[[D written to the screen.
Is there a way I can bind these to the appropriate actions, or is this happening because of a misconfiguration elsewhere?
There are many different shells available; each with their own key bindings. Python's own shell does include a history feature, but doesn't do cursor movement (on Windows, anyway). I'd suggest a python based IDE or some other custom shell (I'll bet even EMACS has python features these days).

Hope that helps.
Jul 10 '07 #4
Motoma
3,237 Expert 2GB
There are many different shells available; each with their own key bindings. Python's own shell does include a history feature, but doesn't do cursor movement (on Windows, anyway). I'd suggest a python based IDE or some other custom shell (I'll bet even EMACS has python features these days).

Hope that helps.
Interesting, I am running Python 2.4 on Windows, and it does history and cursor movement just fine.

The research I did on my own provided very few results, the only fruitful one asserted that I need to recompile Python. My target machine is a tiny gumstix board with 32MB of on board storage, and only serial and ssh access, therefore the recompiling process is a long one and IDEs (and even emacs) are entirely out of the question.
Jul 10 '07 #5
bartonc
6,596 Expert 4TB
Interesting, I am running Python 2.4 on Windows, and it does history and cursor movement just fine.

The research I did on my own provided very few results, the only fruitful one asserted that I need to recompile Python. My target machine is a tiny gumstix board with 32MB of on board storage, and only serial and ssh access, therefore the recompiling process is a long one and IDEs (and even emacs) are entirely out of the question.
Ok - I take it back: The cursor will move right and left. I'm used to a full GUI IDE that lets me go up to a previous line and hit return to re-run that line, page up, page down, beginning and end, as I please.

I got by with IDLE for a long time, but I'm not sure of the memory requirements.
Jul 10 '07 #6
Motoma
3,237 Expert 2GB
Ok - I take it back: The cursor will move right and left. I'm used to a full GUI IDE that lets me go up to a previous line and hit return to re-run that line, page up, page down, beginning and end, as I please.

I got by with IDLE for a long time, but I'm not sure of the memory requirements.
Well, the problem with IDLE is that I don't actually have a screen connected to the device. Can IDLE work in a text only mode?
Jul 10 '07 #7
bartonc
6,596 Expert 4TB
Well, the problem with IDLE is that I don't actually have a screen connected to the device. Can IDLE work in a text only mode?
The only remoting hits that I am getting are for pydev under eclipse.
Jul 10 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Paul Nathan | last post: by
4 posts views Thread by Andrew DeFaria | last post: by
3 posts views Thread by Lachlan Hunt | last post: by
1 post views Thread by bj | last post: by
5 posts views Thread by Rob | last post: by
1 post views Thread by Martijn Mulder | last post: by
reply views Thread by Martijn Mulder | last post: by
6 posts views Thread by tac-tics | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.