Getting the arrow keys to work properly in Python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    Getting the arrow keys to work properly in Python

    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 misconfiguratio n elsewhere?
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by Motoma
    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 misconfiguratio n elsewhere?
    Hey, Motoma. Will you remind me of you OS environment, please.

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      Originally posted by bartonc
      Hey, Motoma. Will you remind me of you OS environment, please.
      Oops, sorry guys, I am running this on Linux :P

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by Motoma
        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 misconfiguratio n 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.

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          Originally posted by bartonc
          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.

          Comment

          • bartonc
            Recognized Expert Expert
            • Sep 2006
            • 6478

            #6
            Originally posted by Motoma
            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.

            Comment

            • Motoma
              Recognized Expert Specialist
              • Jan 2007
              • 3236

              #7
              Originally posted by bartonc
              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?

              Comment

              • bartonc
                Recognized Expert Expert
                • Sep 2006
                • 6478

                #8
                Originally posted by Motoma
                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.

                Comment

                Working...