Were you using the same numbers file across your tests ? Looks like the numbers file that is failing has a blank or empty line after the last number. Try removing it with a line editor like Vim/ed/pico to make sure no extra line feeds or empty lines exist..
Just as a tip - try this slight addition to the script :
- import sys
-
sum = 0
-
while True:
-
try:
-
line = raw_input()
-
except EOFError:
-
break
-
else:
-
print "Hey - I've got a line line:'%s'" % line
-
sum += int(line)
-
print sum
It some times helps when you have a bug like this to put in a print statement to see what python is getting !