[Tutor] New guy question...

Alan Gauld alan.gauld at btinternet.com
Tue Sep 15 01:38:48 CEST 2009


"Warren" <warren at wantonhubris.com> wrote

> while True:
>       line = input()

Beats me, it works OK on my XP box.
> try:
>      number = int(line)
> except ValueErr as err:

Are you sure this shouldn't be ValueError rather than ValueErr?

It won't be causing your current problem but it might cause 
your next one! :-)

> Now, what happens is that this starts up and immediately dies, giving  
> me this error:
> 
> 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.

How are you running the code?
Are you typing it into a file and then running the file?
If so are you typing python foo.py or double clicking the file in Finder?
Are you using an IDE? If so which?

Finally which version of Python are you using? v3.0 or 3.1 or something 
else?

Clutching at straws...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/



More information about the Tutor mailing list