← Back

Home › Errors › TypeError

TypeError: 'int' object is not callable

Exception: TypeErrorCategory: runtimeRaised at: the moment () is applied to a value that is not a function or class

What this error means

You put parentheses after something that is not a function. sum(...) only works while sum still refers to the built-in function — the moment a variable named sum holds 0, the name points at a number, and numbers cannot be called.

The quoted type names the value that got called: 'int' object is not callable, 'str' object is not callable, 'list' object is not callable, 'NoneType' object is not callable. Whichever it is, the question is the same — what did this name used to point at?

Cause 1 — you overwrote a built-in name

sum = 0
for n in [10, 20, 30]:
    sum = sum + n

print(sum([4, 5]))     # sum is now the number 60
Traceback (most recent call last):
  File "demo.py", line 5, in <module>
    print(sum([4, 5]))
          ^^^^^^^^^^^
TypeError: 'int' object is not callable

The built-ins most often reused as variable names: sum, len, max, min, list, str, int, float, type, id, input, print, range, map, filter, dict, set, sorted, next, hash, format. Rename the variable — total, count, maximum, items, text, kind, user_id:

total = 0
for n in [10, 20, 30]:
    total += n

print(total, sum([4, 5]))   # 60 9

Cause 2 — a missing operator between a value and a call

Python reads 2 (3 + 4) as 'call the object 2 with the argument 7'. A dropped *, + or comma turns two expressions into a call:

width = 3
height = 4
area = width (height)        # meant width * height

total = len("abc") (2)       # meant len("abc") + 2

Cause 3 — calling the result of a call

An extra pair of parentheses calls whatever came back. If that was a number or a string, you get this error:

def price():
    return 250

total = price()()      # 250() — 'int' object is not callable
name = str(42)()       # '42'() — 'str' object is not callable

Cause 4 — the name was reassigned earlier in the same scope

This one hides well because the crash is far from the mistake. A loop variable, a parameter or a for target that reuses a function's name silently replaces it for the rest of the scope:

def report(rows):
    for rows in rows:      # rows is now an int on the second pass
        print(rows)
    return len(rows)       # len(int) is fine, but rows(...) would not be

How to debug it

  1. Look at the traceback line and find the name immediately before (. That name is no longer a function.
  2. Search the file — and any from x import * it uses — for that name on the left of an =. The assignment is the bug.
  3. Run python -c "import builtins; print(type(sum))" in a clean shell, then print type(sum) in your program. If it differs, something shadowed it.
  4. Delete the stray parentheses if the intent was arithmetic, not a call: width * height, not width (height).
  5. Turn on a linter (ruff or flake8 with the builtins plugin) — 'redefinition of unused built-in' catches this class of bug before it ever runs.

Fix it interactively

Practice the calling rules on these free problems — they run in the browser:

Practice more Python bugs →

Related messages worth knowing

🇮🇳 Hindi में समझें

TypeError: 'int' object is not callable ka matlab hai aapne kisi number ke aage bracket laga diya. Sabse common wajah: aapne built-in function ka naam variable bana liya — jaise sum = 0 likhne ke baad sum([4, 5]) call karna. Ab sum ek number hai, function nahi. Fix: variable ka naam badal do (total, count, items) — sum, len, max, min, list, str, type, id jaise built-in naam kabhi variable mat banao. Doosri wajah: operator missing hai, width (height) likh diya jab width * height chahiye tha. Teesri: extra bracket — price()() me 250() call ho raha hai.

Python beginner गलतियाँ Hindi में पढ़ें →