gett error message: "TypeError: 'int' object is not callable"

Nick nleioatt at gmail.com
Thu Jul 9 10:08:05 EDT 2009


On Jul 9, 10:02 am, "Richard Brodie" <R.Bro... at rl.ac.uk> wrote:
> "Nick" <nleio... at gmail.com> wrote in message
>
> news:e54c4461-c0b7-42fb-8542-cefd7bf5f89f at h18g2000yqj.googlegroups.com...
>
> > file = open(prefix1)
> > text = file.readlines()
> > len = len(text)
>
> You have redefined two built-in functions "file" and "len" in the first three lines.
> This is usually considered poor practice. Stick to meaningless variable names,
> it's safer (only joking).
>
> TypeError: 'int' object is not callable". This means that something you thought
> was a function is in fact an integer. It's helpful to post/look at the line number of
> the error; "how is this line failing", is much easier to answer than
> "how is my program failing".
>
> print len(fields)
>
> Here len is an integer, because you redefined it in line 3. I'm guessing this is the
> problem.

thanks for spotting the obvious errors, its my 2nd day programming
python in about 3 years.
fridrick, code should be workable with the exception of the
errors...thats the whole program

Thanks again for all the help problem fixed



More information about the Python-list mailing list