On Mon, Sep 14, 2009 at 12:30 PM, Warren <war...@wantonhubris.com> wrote: > Type integers, each followed by ENTER; or just ENTER to finish > Traceback (most recent call last): > method <module> in test.py at line 9 > line = input() > EOFError: EOF when reading a line > > Why is the "input" statement not waiting for input like it should be and > instead killing the app? My google-fu is failing me on this one. >
Try changing it to raw_input() instead... >From the docs: input([prompt]) Equivalent to eval(raw_input(prompt)). In other words, Python is trying to evaluate your input as a valid Python statement at the moment you enter it. I don't quite see why eval(blank line) == EOF, but apparently it does... When I tried your code, if I pressed Enter it blew up with the same error you reported; if I entered integers instead, it accepted them happily until my first blank line, at which point it again complained of an EOF. (I'm running 2.62 on Windows, by the way.) Changing to raw_input() made things work, so I think it's the implicit eval(). -- www.fsrtechnologies.com _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor