Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: '_io.TextIOWrapper' object is not callable, creating text file error

    list = [Blarg, T2, T3]
    Rewrite(List)


    def Rewrite(New2):
        List_Length = len(New2)
        L = 0
        with open('Chronologiser2.BCF', 'w') as file_output:
            file_output('')

        while L < List_Length:
            with open('Chronologiser2.BCF', 'a') as file_output:
                Current_Text = New2[L]
                file_output(str(Current_Text) + '/n')
                L += 1

Can someone explain to me why i keep getting the 'TypeError: '_io.TextIOWrapper' object is not callable' error, I've wracked my brain, looked at similair questions but still nothing

like image 490
Mohsin Kale Avatar asked Oct 29 '15 17:10

Mohsin Kale


1 Answers

you need to call the write method of file_output, not call it directly:

file_output.write('')
like image 55
hiro protagonist Avatar answered Oct 21 '22 08:10

hiro protagonist