title: EOFError: Ran out of input
body: <p>When I run the code below I get this error message &quot;EOFError: Ran out of input&quot;
  what does it mean?? How it can be corrected?? and how to output the records details on the screen.</p>
  <pre><code>import pickle # this library is required to create binary files
  class CarRecord:
      def __init__(self):
        self.VehicleID = &quot; &quot;          
        self.Registration = &quot; &quot;
        self.DateOfRegistration = &quot; &quot;
        self.EngineSize = 0           
        self.PurchasePrice = 0.00
  
  ThisCar = CarRecord()
  Car = [ThisCar for i in range(2)] # list of 2 car records
  
  Car[0].VehicleID = &quot;CD333&quot;
  Car[0].Registration = &quot;17888&quot;
  Car[0].DateOfRegistration = &quot;18/2/2017&quot;
  Car[0].EngineSize = 2500
  Car[0].PurchasePrice = 22000.00
  
  Car[1].VehicleID = &quot;AB123&quot;
  Car[1].Registration = &quot;16988&quot;
  Car[1].DateOfRegistration = &quot;19/2/2017&quot;
  Car[1].EngineSize = 2500
  Car[1].PurchasePrice = 20000.00
  
  CarFile = open ('Cars.TXT', 'wb' ) # open file for binary write
  for j in range (2): # loop for each array element
      pickle.dump (Car[j], CarFile) # write a whole record to the binary file
  CarFile.close() # close file
  
  CarFile = open ('Cars.TXT','rb') # open file for binary read
  Car = [] # start with empty list
  while True: #check for end of file
      Car.append(pickle.load(CarFile)) # append record from file to end of list
  CarFile.close()
  </code></pre>