arrow keys don't work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tac-tics

    #1

    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.

  • Robert Kern

    #2
    Re: arrow keys don't work

    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

    Comment

    • tac-tics

      #3
      Re: arrow keys don't work


      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?

      Comment

      • Steven D'Aprano

        #4
        Re: arrow keys don't work

        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

        Comment

        • tac-tics

          #5
          Re: arrow keys don't work

          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.

          Comment

          • tac-tics

            #6
            Re: arrow keys don't work

            It looks like I got readline working. Thanks for the help!

            Comment

            • Terry Reedy

              #7
              Re: arrow keys don't work


              "tac-tics" <tactics40@gmai l.comwrote in message
              news:1169511711 .594390.167630@ 11g2000cwr.goog legroups.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



              Comment

              Working...