Gerrit van Dyk wrote: > Try using raw_input() instead of the sys.stdin.readline(). raw_input() > is the preferred way of getting console input.
Is it? Guido's "Python Regrets" slides (Google for them) seems to say the opposite. Besides, that's not the problem here... Alexander Zatvornitskiy wrote: > I'am using eric3 IDE under win32 (snapshot 2005-04-10), and have a trouble. I > use this code: > print "enter q to quit, or smthing else to continue" > while not sys.stdin.readline()=="q": > smthing(else) That will actually work in a vanilla Unix Python interpreter if you type q followed by Ctrl-D twice, but I suspect that's not what you intended... The readline method includes the whole line, including the linefeed character if you press q followed by ENTER. If you change it to... while not sys.stdin.readline()=="q\n": ...I guess it will work in eric3. (It works in IDLE then.) You might even want something more robust, such as while not sys.stdin.readline().strip().lower() == "q": In general, your construct makes it a bit difficult for you to debug your own code. If you had written it like below... while True: inp = sys.stdin.readline() if inp == 'q': break smthing(else) # Not that you can use else as a name... ...it would have been trivial to insert "print repr(inp)" which ought to have given you a clue of what was going on... Changes and experiments like that are very easy to do in Python. It beats staring at the code in confusion 99 times out of 100. It's typically much faster than asking on c.l.py, although not educational for as many people... ;) -- http://mail.python.org/mailman/listinfo/python-list