Problem in Eclipse 3.2/Python 2.4 about '\r'

  • moon

    moon - 2006-07-28

    for example:

    def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
        while 1:
            ok = raw_input(prompt)
            if ok in ('y', 'yes'):
                return True
            if ok in ('n', 'no'):
                return False
            retries = retries - 1
            if retries < 0:
                raise IOError, 'refusenik user'
            print complaint

    while 1:
        flag = ask_ok('are you really want to quit?')
        if flag == True:
    print 'out'

    In Eclipse 3.2/Python 2.4,the output always is"Yes or no, please! "
    however,if you add a '\r' after the word which compare with 'ok',e.g.'y'->'y\r'. Then the result will be right.
    So,I guess Pydev don't have a good deal with the 'enter'.It should only be the end of input,not in the input.

    • moon

      moon - 2006-07-28

      if you use IDLE,there is no problem

    • Fabio Zadrozny

      Fabio Zadrozny - 2006-07-28

      Nope, this is a python bug mixed with a bad specification on how a shell is supposed to behave.

      Usually shells put a '\n' when you press enter, but the Eclipse console puts '\r\n' and python does not handle it well, as this is not specified anywhere, and does not seem such awkward, my feeling is that it's a python bug, but you can surely argue the other way... so, you can submit a bug to and and see who'll fix it... (or you can handle it in your program).




Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks