If I make a program "prog.py" in Python with this code:
#!/usr/bin/python3.3
# -*-coding:Utf-8 -*
while True:
number = int(input())
print(number * 2)
I have a file "numbers.txt" with that:
1
2
3
4
5
6
7
8
9
10
And I run it like that:
chmod +x prog.py
cat numbers.txt | ./prog.py
I get that:
2
4
6
8
10
12
14
16
18
20
Traceback (most recent call last):
File "./prog.py", line 5, in <module>
number = int(input())
EOFError: EOF when reading a line
Why this error?