Python Slicing Syntax

I’m writing a script to parse content from a file. I’m getting a ValueError at the end of my script, but I’m not entirely sure why. I thought my slicing snytax was correct, as it is pretty similair to range(). Am I misunderstanding how slicing works?

INPUT = "C:\Users\Documents\filestest\asys_jem_dev.csv"
OUTPUT = "C:\Users\Documents\filestest\outputtest.csv"


LINE = "{:<6} {:34} {:18} {:10} {:10} {:10} {:10} {:10}
"


def get_lines(n, inf):
    return [next(inf) for _ in xrange(n)]


def read_header(inf):
    head = get_lines(6, inf)
    job_name = head[2].split(None, 1)[0]
    system_num = job_name[1:5]
    return system_num, job_name


def read_record(inf):
    record    = get_lines(5, inf)
    startline = record[2].split()
    sd, st, name = startline[5:8]
    endline   = record[4].split()
    status    = endline[0]
    ed, et    = endline[5:7]
    # skip failure message
    if status == "FAILURE":
        get_lines(2, inf)
    return name, status, sd, st, ed, et


def parse_jobfile(fname):
    with open(fname) as inf:
        try:
            batch = read_header(inf)
            while True:
                job = read_record(inf)
                yield batch + job
        except StopIteration:
            # end of file
            pass


def mainf():
    with open(OUTPUT, "w") as outf:
        outf.write(LINE.format("SysNum", "Job Name", "Target Machiene", "Status", "Start Date", "Start Time", "End Date", "End Time"))
        for result in parse_jobfile(INPUT):
            outf.write(LINE.format(*result))
mainf()

C:\Python27>python ./jemtest.py
Traceback (most recent call last):
  File "./jemtest.py", line 43, in <module>
    mainf()
  File "./jemtest.py", line 41, in mainf
    for result in parse_jobfile(INPUT):
  File "./jemtest.py", line 32, in parse_jobfile
    job = read_record(inf)
  File "./jemtest.py", line 18, in read_record
    sd, st, name = startline[5:8]
ValueError: need more than 2 values to unpack

Are you sure that your input file has as many values as you are expecting?

Best wishes,
Matthew