<div class="gmail_quote">On Mon, Sep 14, 2009 at 3:31 PM, Marc Tompkins <span dir="ltr"><<a href="mailto:marc.tompkins@gmail.com">marc.tompkins@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, Sep 14, 2009 at 12:30 PM, Warren <<a href="mailto:warren@wantonhubris.com">warren@wantonhubris.com</a>> wrote:<br>
> Type integers, each followed by ENTER; or just ENTER to finish<br>
> Traceback (most recent call last):<br>
> method <module> in test.py at line 9<br>
> line = input()<br>
> EOFError: EOF when reading a line<br>
><br>
> Why is the "input" statement not waiting for input like it should be and<br>
> instead killing the app? My google-fu is failing me on this one.<br>
><br>
<br>
</div>Try changing it to raw_input() instead...<br>
>From the docs:<br>
input([prompt])<br>
Equivalent to eval(raw_input(prompt)).<br>
<br>
In other words, Python is trying to evaluate your input as a valid<br>
Python statement at the moment you enter it.<br>
I don't quite see why eval(blank line) == EOF, but apparently it does...<br>
<br>
When I tried your code, if I pressed Enter it blew up with the same<br>
error you reported; if I entered integers instead, it accepted them<br>
happily until my first blank line, at which point it again complained<br>
of an EOF. (I'm running 2.62 on Windows, by the way.) Changing to<br>
raw_input() made things work, so I think it's the implicit eval().</blockquote><div><br></div><div>On python3 they changed input to work like raw_input, or am I mistaken? </div><div><br></div><div>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</div>
<div><br></div><div>import platform</div><div>platform.python_version()</div><div><br></div><div>he'll get something < 3.0</div><div><br></div><div>-Wayne</div></div>