In the following code:
def data_from_file(fname, sep=';'):
    file_iter = open(fname, 'r')
    for line in file_iter:
        line = line.strip()
        if 0 == len(line): continue
        row = line.split(sep)
        try:
            leg = int(row[2])
        except ValueError:
            leg = "NONE"
        yield DATA(type=row[1], leg=leg, time=int(row[3]), id=row[0])
I am getting the error message:
in data_from_file
    leg = int(row[2])
IndexError: list index out of range
How can I fix this?
 
     
    