"TypeError: 'int' object is not callable"

Rhodri James rhodri at wildebst.demon.co.uk
Mon Jun 1 07:16:57 EDT 2009


On Mon, 01 Jun 2009 11:40:50 +0100, Visco Shaun <visco31 at gmail.com> wrote:

> when I was executing the below code I got "TypeError: 'int' object is
> not callable" exception. Why is it so?
>
> if type(c) == type(ERROR):
>
> c can be a string or an integer representing an error

In the absence of the rest of your code this is a wild guess, but have
you used `type` as a variable?  If you have, that would mask the builtin
name `type`, and would give you this error assuming `type` contains an
integer.

Moral: don't use builtin names for variables.

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list