- Home /
What is an EOF error and how can i fix the problem?
While testing my program I got an error saying "carreg = input ("car reg") File "", line 1 kj56 ncb ^ SyntaxError: unexpected EOF while parsing" How do I fix this? Excuse the most likely bad coding I have just started my GCSE Course.
This is the whole program:
import csv
carno = 'CarRegestration.csv'
carDetails = open(carno,'r')
fileReader = csv.reader(carDetails, delimiter= ',')
people = []
for row in fileReader:
people.extend(row)
carDetails.close()
print("\n".join(people))
carreg = input ("Input the Cars Regetration:")
speed = int(input("speed"))
speedstr = str(speed)
count = 0
while count <60:
if (people[count]) != carreg:
count=count+3
else:
message = carreg + "was driving at" + speedstr + "mph. Owner" +people [count +1] +""+ people [count+2]+". You have recieved a fine at the sum of £50 and 3 points on your licence."
print(message)
with open ("Speedingfine.csv","w") as fine:
fine.write("{}\n".format(message))
numplate = count
count = 100
Answer by tanoshimi · Nov 27, 2014 at 10:11 PM
EOF = "End of File".
It almost certainly means there's a problem with your carregistration.csv file. Perhaps unescaped "," marks, a bad line terminator, something like that.
Answer by JK346 · Nov 28, 2014 at 09:29 AM
Thanks, I actually realised that I was using Python 2.7.3 so it wasn't running the "import csv" at the top of the program so when I switched over to Python 3 the program runs perfectly.
Your answer
Follow this Question
Related Questions
Why doesnt my script work 2 Answers
EOF what does it mean? 3 Answers
BCE0044: expecting EOF, found }` error In my scripy 2 Answers
Error BCE0044 plz help 0 Answers