TypeError: 'int' object is not callable means you used () after something that is an integer, as if it were a function. In Python, only callable objects (functions, methods, classes) can be invoked with (). This error often comes from overwriting a built-in like len with a number, or from using parentheses instead of square brackets for indexing. This guide explains causes and fixes.
What this error means
“Callable” means you can write thing(...) and Python will run it. Functions and methods are callable; integers, strings, and lists are not. If x is an int and you write x(0) or x(), you get TypeError: 'int' object is not callable. Similar errors: list not callable, dict not callable.
Common causes
- Overwriting a built-in. You use a name like
len,sum, ormaxas a variable and assign an integer (or other non-callable) to it. Later,len(...)tries to “call” that value and fails. - Wrong brackets. You use
items(0)instead ofitems[0]. Parentheses mean “call”; square brackets mean “index”. - Variable holds an int instead of a function. You expect a function reference but the variable was reassigned to a number.
Example: overwriting len
len = 5 # Overwrote the len() function
result = len([1, 2, 3]) # TypeError: len is now 5, not a function
Fix 1: do not use built-in names as variables
length = 5 # Use a different name
result = len([1, 2, 3]) # OK: len() still works
Example: parentheses instead of brackets
items = [10, 20, 30]
value = items(0) # TypeError: use items[0] for indexing
Fix 2: use square brackets for indexing
value = items[0] # OK
When you really need to call something
If the “function” might be an int (e.g. from another module or config), check before calling:
if callable(my_func):
result = my_func()
else:
print("my_func is not callable")
Next steps: Errors & Exceptions · TypeError: list not callable · Functions