IndexError message in Python using 'with' statement
<p>I have input and output variables assigned to a function definition to grab entries from a GUI, input(read) a .txt file and create(write) an output .txt file that will split some columns of data specifically below:</p>

<pre><code>def runTransferDialog():
    e1, e2 = StringVar(), StringVar()
    PackDialog(e1, e2)
    input, output = e1.get(), e2.get()         # GUI entries assigned to variables
    if input !='' and output !='':
        with open(input, 'r') as input1:        # read input .txt file
            with open(output, 'w') as output1:   # write input .txt file
                for line in input1:
                    columns = line.strip().split()
                    output1.write('{:8}{:8}\n'.format(columns[0], columns[3])
</code></pre>

<p>Compiled I get "IndexError: list index out of range", an output .txt file did generate but there is no column of data in it.  What happened?</p>
