On Mon, Sep 14, 2009 at 3:31 PM, Marc Tompkins <marc.tompk...@gmail.com>wrote:
> 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(). On python3 they changed input to work like raw_input, or am I mistaken? But as I test, my 2.6 gives an identical error so I'm suspecting there's a problem with that shebang line. I also suspect if the OP puts import platform platform.python_version() he'll get something < 3.0 -Wayne
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor