473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

arrow keys don't work

I've noticed that in Python 2.5, the interactive prompt does not
support intelligent use of arrow keys like 2.4 did (up/down for
previous/next statement, left/right for moving the cursor). What
exactly is the reason for this and is there an easier fix than
downgradinig to 2.4? Thanks.

Jan 22 '07 #1
6 3593
tac-tics wrote:
I've noticed that in Python 2.5, the interactive prompt does not
support intelligent use of arrow keys like 2.4 did (up/down for
previous/next statement, left/right for moving the cursor). What
exactly is the reason for this and is there an easier fix than
downgradinig to 2.4? Thanks.
Your installation of 2.4 probably had the readline module installed while your
installation of 2.5 doesn't. What platform are you on?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Jan 22 '07 #2

Robert Kern wrote:
tac-tics wrote:
I've noticed that in Python 2.5, the interactive prompt does not
support intelligent use of arrow keys like 2.4 did (up/down for
previous/next statement, left/right for moving the cursor). What
exactly is the reason for this and is there an easier fix than
downgradinig to 2.4? Thanks.

Your installation of 2.4 probably had the readline module installed while your
installation of 2.5 doesn't. What platform are you on?
Actually, I should have posted this a while ago. I've noticed it on
Ubuntu Linux, Mac OSX, and earlier today on Sun Solaris.

What do I need to do to install / configure readline?

Jan 23 '07 #3
On Mon, 22 Jan 2007 14:53:01 -0800, tac-tics wrote:
I've noticed that in Python 2.5, the interactive prompt does not
support intelligent use of arrow keys like 2.4 did (up/down for
previous/next statement, left/right for moving the cursor).
It works perfectly for me.
What
exactly is the reason for this and is there an easier fix than
downgradinig to 2.4? Thanks.
Have you changed your terminal (either the program itself or its config)
so that it is no longer sending the correct codes?

When you hit the arrow key, what happens? Do you just get nothing at all,
or do you get control characters appearing? e.g. ^Z or similar.
--
Steven D'Aprano

Jan 23 '07 #4
Have you changed your terminal (either the program itself or its config)
so that it is no longer sending the correct codes?
I doubt this is the case. Everything works for the bash shell and
common lisp. It's just python acting up.
When you hit the arrow key, what happens? Do you just get nothing at all,
or do you get control characters appearing? e.g. ^Z or similar.
udlr yields ^[[A^[[B^[[C^[[D in the interactive python interpreter, but
like I said, works like it should outside the Python interpreter.

Jan 23 '07 #5
It looks like I got readline working. Thanks for the help!

Jan 23 '07 #6

"tac-tics" <ta*******@gmail.comwrote in message
news:11**********************@11g2000cwr.googlegro ups.com...
|Have you changed your terminal (either the program itself or its config)
| udlr yields ^[[A^[[B^[[C^[[D in the interactive python interpreter, but
| like I said, works like it should outside the Python interpreter.

If I remember correctly, '^[' represents the escape character and '^[[A',
etc represent the standard ANSI terminal escape sequences for the up, etc,
key. So you are missing the interpretive layer that should intercept and
act on those sequences and Python is getting them raw (literally).

tjr

Jan 23 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul Nathan | last post by:
While trying to write a simple game which uses the arrow keys, I noticed that under the subroutine that handles mybase.keydown, everytime I pressed any arrow keys, or in fact any of the 9 keys...
2
by: Darren Oakey | last post by:
ok - the problem - I made a simple breakout game out of a form, just painting the background - and using keydown for left and right arrow keys to control the bat - worked fine. I then moved all...
1
by: bj | last post by:
How to process arrow keys? Hello I need to catch arrow keys down event from control derivied from usercontrol -OnKeyDown method seems to work for all keys besides arrow keys -however OnKeyUp...
4
by: Neil Wallace | last post by:
Hi there, I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel. They are added in runtime, and so they adopt a...
11
by: Rlrcstr | last post by:
How can you detect when an arrow key gets pressed? Doesn't seem to trigger a KeyPress or KeyDown event. Thanks. Jerry
5
by: Rob | last post by:
If I use the following code: Private Sub Form1_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) _ Handles MyBase.KeyDown Dim myKey As Integer myKey =...
2
by: Vincent | last post by:
Hi, I have a user control that needs to trap the arrow keys to move items around internally. However, using the arrow keys will move the focus to another control on the form hosting the user...
1
by: Martijn Mulder | last post by:
/* I have problems detecting the Arrow Keys on a User Control. A control derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys but does react on the combination <Altor <Ctrl+ Arrow...
0
by: Martijn Mulder | last post by:
/* I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my custom System.Windows.Forms.Control. But, holding down the Shift-Key prevents the Arrow Keys from coming through. How can...
9
by: Laphan | last post by:
Hi All I'm using the below to limit the input into a text box to just letters, numbers, hyphens and full stops, but I also need to allow the backspace, delete and arrow keys to come through. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.