fuckingpython.lol

Python errors › TypeError

TypeError: 'str' object is not callable

Updated

The Python error "'str' object is not callable" usually means a variable called str, input or a method name now holds a string. How to find it, and the fix.

What you see

main.py
str = "Total: "
count = 3
print(str(count))
Python 3.15 prints
Traceback (most recent call last):
  File "/home/me/project/main.py", line 3, in <module>
    print(str(count))
          ~~~^^^^^^^
TypeError: 'str' object is not callable

What it means

You put round brackets after something that is not a function. Brackets mean "call this", and a string cannot be called.

Most often the name used to be a function. The first line above replaces the builtin str with a string, so str(count) on the third line calls that string. The same happens with list, dict, input, sum, max and type, each with its own type in the message: "'list' object is not callable", "'int' object is not callable".

Why it happens

  • A variable named after a builtin, as in the example.
  • An attribute and a method with the same name. self.name = "Ada" in __init__ replaces a method called name on that instance.
  • A missing operator, as in 2(3 + 4) for 2 * (3 + 4). Python compiles this with a warning, "perhaps you missed a comma?", and fails when it runs.
  • Brackets after a value: "text"() or response.status_code() when status_code is a number.

How to fix it

Rename the variable so it no longer hides the builtin:

label = "Total: "
count = 3
print(label + str(count))

In a notebook or the interactive prompt, the old variable stays around after you fix the code. Delete it to get the builtin back, or restart the kernel:

del str

How each Python version words it

PythonPrints
3.9–3.15TypeError: 'str' object is not callable

Run on CPython 3.9.6, 3.10.22, 3.11.17, 3.12.15, 3.13.17, 3.14.9 and 3.15.1, on October 25, 2026.

The wording is the same in every version here.

Questions

It worked before and now fails in Jupyter

A cell that ran earlier assigned the name, and it stays assigned until the kernel restarts. Run del str, or restart and run all cells in order.

How do I find where the name was replaced?

Search the file for str = or def str. print(type(str)) just before the failing line shows what the name holds now.

Sources

Read on October 25, 2026.