arrow keys don't work

Discussion in 'Python' started by tac-tics, Jan 22, 2007.

  1. tac-tics

    tac-tics Guest

    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.
    tac-tics, Jan 22, 2007
    #1
    1. Advertising

  2. tac-tics

    Robert Kern Guest

    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
    Robert Kern, Jan 22, 2007
    #2
    1. Advertising

  3. tac-tics

    tac-tics Guest

    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?
    tac-tics, Jan 23, 2007
    #3
  4. 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
    Steven D'Aprano, Jan 23, 2007
    #4
  5. tac-tics

    tac-tics Guest

    > 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.
    tac-tics, Jan 23, 2007
    #5
  6. tac-tics

    tac-tics Guest

    It looks like I got readline working. Thanks for the help!
    tac-tics, Jan 23, 2007
    #6
  7. tac-tics

    Terry Reedy Guest

    "tac-tics" <> wrote in message
    news:...
    |> 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
    Terry Reedy, Jan 23, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob R. Ainscough
    Replies:
    0
    Views:
    689
    Rob R. Ainscough
    Jul 20, 2005
  2. (Pete Cresswell)
    Replies:
    2
    Views:
    574
    (Pete Cresswell)
    Oct 12, 2004
  3. Daniel Alexandre

    Arrow-keys bug.

    Daniel Alexandre, Feb 23, 2005, in forum: Python
    Replies:
    0
    Views:
    384
    Daniel Alexandre
    Feb 23, 2005
  4. Vidar Gundersen
    Replies:
    1
    Views:
    772
  5. jitrowia
    Replies:
    2
    Views:
    362
    Dennis Lee Bieber
    Jan 26, 2008
Loading...

Share This Page