Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > arrow keys don't work

Reply
Thread Tools

arrow keys don't work

 
 
tac-tics
Guest
Posts: n/a
 
      01-22-2007
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.

 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      01-22-2007
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

 
Reply With Quote
 
 
 
 
tac-tics
Guest
Posts: n/a
 
      01-23-2007

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?

 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-23-2007
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

 
Reply With Quote
 
tac-tics
Guest
Posts: n/a
 
      01-23-2007
> 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.

 
Reply With Quote
 
tac-tics
Guest
Posts: n/a
 
      01-23-2007
It looks like I got readline working. Thanks for the help!

 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      01-23-2007

"tac-tics" <> wrote in message
news: 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing control of arrow keys in FF 1.5.0.3 Z Firefox 4 08-16-2006 02:15 AM
Loss of arrow keys in input boxes Jim Firefox 22 07-11-2006 05:56 AM
Loss of arrow keys in input boxes Jim Firefox 0 07-10-2006 03:33 AM
Design time -- can't move Label controls using arrow keys?? Rob R. Ainscough ASP .Net 0 07-20-2005 04:17 AM
Allowing user to scroll navigation panel via arrow keys? (Pete Cresswell) HTML 2 10-12-2004 01:47 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57