how to move cursor in Interactive Interpreter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yan.python@gmail.com

    how to move cursor in Interactive Interpreter

    i have a question.
    when i run Interactive Interpreter in linux command promt,how can i
    move the cursor.
    for example,when i enter a string,i often enter the quotation mark ""
    first,and the move the cursor inside the mark to enter the string,in
    windows,it is ok.but when i do that in linux,pressing the "left" key
    will just print "^[[D" in the screen ,but not what i want.
    so , how can i move the cursor Interactive Interpreter in linux?
    i've googled and find nothing useful.who i tell me what to do?

  • Peter Otten

    #2
    Re: how to move cursor in Interactive Interpreter

    yan.python@gmai l.com wrote:
    i have a question.
    when i run Interactive Interpreter in linux command promt,how can i
    move the cursor.
    for example,when i enter a string,i often enter the quotation mark ""
    first,and the move the cursor inside the mark to enter the string,in
    windows,it is ok.but when i do that in linux,pressing the "left" key
    will just print "^[[D" in the screen ,but not what i want.
    so , how can i move the cursor Interactive Interpreter in linux?
    i've googled and find nothing useful.who i tell me what to do?
    Python uses GNU readline for cursor movements. The Python version that ships
    with your distribution should work out of the box. If you compile Python
    yourself make sure that the development package (not just the binary) is
    installed. For Suse this is readline-devel.

    Peter

    Comment

    • yan.python@gmail.com

      #3
      Re: how to move cursor in Interactive Interpreter

      On 8 14 , 2 44 , Peter Otten <__pete...@web. dewrote:
      yan.pyt...@gmai l.com wrote:
      i have a question.
      when i run Interactive Interpreter in linux command promt,how can i
      move the cursor.
      for example,when i enter a string,i often enter the quotation mark ""
      first,and the move the cursor inside the mark to enter the string,in
      windows,it is ok.but when i do that in linux,pressing the "left" key
      will just print "^[[D" in the screen ,but not what i want.
      so , how can i move the cursor Interactive Interpreter in linux?
      i've googled and find nothing useful.who i tell me what to do?
      >
      Python uses GNU readline for cursor movements. The Python version that ships
      with your distribution should work out of the box. If you compile Python
      yourself make sure that the development package (not just the binary) is
      installed. For Suse this is readline-devel.
      >
      Peter
      thanks for your reply
      I thought maybe i just didn't install readline correctly,so i deleted
      python and tried to re-compile the source code(I downloaded the .bz2
      version).This time ,I found in the "./Modules/Setup" the description
      for "readline":

      # GNU readline. Unlike previous Python incarnations, GNU readline is
      # now incorporated in an optional module, configured in the Setup
      file
      # instead of by a configure script switch. You may have to insert a
      # -L option pointing to the directory where libreadline.* lives,
      # and you may have to change -ltermcap to -ltermlib or perhaps remove
      # it, depending on your system -- see the GNU readline instructions.
      # It's okay for this to be a shared library, too.

      #readline readline.c -lreadline -ltermcap

      dont know exactly what to do,I just delete the "#" mark in the line
      "#readline readline.c -lreadline -ltermcap " , then tried to
      "configure","ma ke",but errors of readline occor here.
      what am i supposed to do to install the module GNU readline correctly
      then?
      thanks

      by the way,my linux is Mandriva 10

      Comment

      • Peter Otten

        #4
        Re: how to move cursor in Interactive Interpreter

        yan.python@gmai l.com wrote:
        what am i supposed to do to install the module GNU readline correctly
        then?
        by the way,my linux is Mandriva 10
        Use the package manager of your distribution to install the readline
        development package -- after some struggle with Mandriva's website I came
        to suppose that it's libreadline5-devel for you:

        urpmi libreadline5-devel.rpm

        After you have successfully installed that package unpack the python archive
        into a fresh directory and do the configure/make/install dance. No manual
        changes should be necessary.

        Peter

        Comment

        • yan.python@gmail.com

          #5
          Re: how to move cursor in Interactive Interpreter

          On 8 14 , 9 20 , Peter Otten <__pete...@web. dewrote:
          yan.pyt...@gmai l.com wrote:
          what am i supposed to do to install the module GNU readline correctly
          then?
          by the way,my linux is Mandriva 10
          >
          Use the package manager of your distribution to install the readline
          development package -- after some struggle with Mandriva's website I came
          to suppose that it's libreadline5-devel for you:
          >
          urpmi libreadline5-devel.rpm
          >
          After you have successfully installed that package unpack the python archive
          into a fresh directory and do the configure/make/install dance. No manual
          changes should be necessary.
          >
          Peter


          i've re-install python as you said,and it works now
          i really appreciate your help
          thanks!

          Comment

          Working...