Coding tips

TypeError: 'str' object is not callable in Python: 10 Causes and Fixes, from Shadowed Built-ins to Missing Commas (Tested Examples)

Python raises TypeError: 'str' object is not callable when you put parentheses after something that is a string, so Python tries to call it like a function. Here are 10 real causes, from a variable named str to a missing comma, with tested output and the fix for each.

By 9 min read 0 views
Cover image for TypeError: 'str' object is not callable in Python: 10 Causes and Fixes, from Shadowed Built-ins to Missing Commas (Tested Examples)

TypeError: 'str' object is not callable means you wrote something(...), and something was a string at that moment, not a function. The most common cause is a variable that hides a built-in, such as str = "hello" followed later by str(42), or input = ... followed by input(). Other causes are an attribute with the same name as a method, calling a @property, and a missing + or comma between strings. Rename the variable or remove the stray parentheses.

The same message appears with other types, such as 'int' object is not callable or 'list' object is not callable, and the reasons are the same. The caret markers in Python 3.11 and later point at the exact call that failed.

Every traceback below comes from Python 3.13.5 on my machine, with the main case also run on Python 3.10 and 3.14.8.

In this guide:

  • Cause 1: A variable named str hides the built-in
  • How to confirm a shadowed built-in
  • Cause 2: The same trap with list, dict and other built-ins
  • Cause 3: A variable named input
  • Cause 4: An attribute with the same name as a method
  • Cause 5: Calling a @property
  • Cause 6: Parentheses after a string instead of +
  • Cause 7: A missing + between two strings
  • Cause 8: Forgetting .format on a template
  • Cause 9: A dict or config that stores a string instead of a function
  • Cause 10: A missing comma in a list (with a SyntaxWarning)
  • The same error with int, float, None, list and dict
  • Quick fix table
  • Frequently asked questions

Cause 1: A variable named str hides the built-in

str = "hello"
number = 42
print(str(number))
Traceback (most recent call last):
  File "c01_shadow_builtin.py", line 3, in <module>
    print(str(number))
          ~~~^^^^^^^^
TypeError: 'str' object is not callable

The first line replaced the built-in str function with a string. When line 3 called str(number), Python looked up str, found "hello", and tried to call it. The builtins module documentation explains that names like str, list and input live in a module that your own variables can shadow.

How to confirm a shadowed built-in

If you are in a notebook or a long script, check what the name currently points to:

import builtins
str = "oops"
print(type(str), str is builtins.str)
print("shadowed builtins:", [n for n in ("str", "list", "input", "sum") if n in globals()])
del str
print(type(str), str(42))
print(callable("hello"), callable(print), callable(len))
<class 'str'> False
shadowed builtins: ['str']
<class 'type'> 42
False True True

str is builtins.str was False while the variable existed, and del str brought the built-in back. In Jupyter, a variable from an earlier cell stays alive until you restart the kernel, so rename the variable and restart. callable() is a quick way to check anything before calling it.

Cause 2: The same trap with list, dict and other built-ins

list = [1, 2, 3]
evens = list(range(0, 10, 2))
Traceback (most recent call last):
  File "c02_shadow_list.py", line 2, in <module>
    evens = list(range(0, 10, 2))
TypeError: 'list' object is not callable

The message names the type of the object you tried to call, so list = [...] gives 'list' object is not callable. Use descriptive names like items, text or counts, and the problem disappears:

text = "hello"
number = 42
print(str(number), text)
items = [1, 2, 3]
evens = list(range(0, 10, 2))
print(items, evens)
42 hello
[1, 2, 3] [0, 2, 4, 6, 8]

Linters such as Ruff and Pylint can flag shadowed built-ins before you run anything. If you later use such a list as a dict key, you will hit a different error, covered in my guide to unhashable type: 'list'.

Cause 3: A variable named input

input = "yes"
answer = input("Continue? ")
Traceback (most recent call last):
  File "c08_variable_named_input.py", line 2, in <module>
    answer = input("Continue? ")
TypeError: 'str' object is not callable

This one bites beginners writing small quiz or menu programs. The variable called input stores an answer, and the next prompt fails. Rename it to answer or choice. The Python tutorial on input and output uses names like these.

Cause 4: An attribute with the same name as a method

class User:
    def __init__(self, name):
        self.name = name

    def name(self):
        return self.name.title()

u = User("ana")
print(u.name())
Traceback (most recent call last):
  File "c03_attr_vs_method.py", line 9, in <module>
    print(u.name())
          ~~~~~~^^
TypeError: 'str' object is not callable

self.name = name in __init__ stores a string on the instance, and instance attributes are found before methods on the class. So u.name is the string "ana", and u.name() tries to call it. Give the method a different name, such as display_name().

Cause 5: Calling a @property

class Order:
    @property
    def status(self):
        return "shipped"

print(Order().status())
Traceback (most recent call last):
  File "c07_property_call.py", line 6, in <module>
    print(Order().status())
          ~~~~~~~~~~~~~~^^
TypeError: 'str' object is not callable

A property runs its function for you when you access it, so Order().status is already the string "shipped". Adding () calls that string. Both fixes are in one file:

class User:
    def __init__(self, name):
        self.name = name

    def display_name(self):
        return self.name.title()

class Order:
    @property
    def status(self):
        return "shipped"

print(User("ana").display_name(), Order().status)
Ana shipped

Cause 6: Parentheses after a string instead of +

greeting = "Hello"
name = "Ana"
print(greeting(name))
Traceback (most recent call last):
  File "c04_call_string.py", line 3, in <module>
    print(greeting(name))
          ~~~~~~~~^^^^^^
TypeError: 'str' object is not callable

Here the intent was to combine two strings. There are several correct ways to do that:

greeting = "Hello"
name = "Ana"
print(greeting + " " + name)
print(f"{greeting} {name}")
print("Hi {}".format(name))
price = "Total: "
print(price + "12.50")
Hello Ana
Hello Ana
Hi Ana
Total: 12.50

f-strings are the clearest choice in modern Python, and my guide to f-string formatting covers them in depth.

Cause 7: A missing + between two strings

price = "Total: "
print(price ("12.50"))
Traceback (most recent call last):
  File "c05_missing_operator.py", line 2, in <module>
    print(price ("12.50"))
          ~~~~~~^^^^^^^^^
TypeError: 'str' object is not callable

A space between a name and ( still means a call, so price ("12.50") calls price. The fix is the missing +, shown in the last line of the fixes above. Python 3.10 shows the same message without the caret markers:

Traceback (most recent call last):
  File "c01_shadow_builtin.py", line 3, in <module>
    print(str(number))
TypeError: 'str' object is not callable

Cause 8: Forgetting .format on a template

template = "Hi {}"
print(template("Ana"))
Traceback (most recent call last):
  File "c06_format_paren.py", line 2, in <module>
    print(template("Ana"))
          ~~~~~~~~^^^^^^^
TypeError: 'str' object is not callable

Write template.format("Ana"). The string module documentation covers the format syntax used by str.format().

Cause 9: A dict or config that stores a string instead of a function

handlers = {"greet": "say_hello"}
handlers["greet"]()
Traceback (most recent call last):
  File "c09_dict_value.py", line 2, in <module>
    handlers["greet"]()
    ~~~~~~~~~~~~~~~~~^^
TypeError: 'str' object is not callable

Dispatch tables and plugin registries often store a function name as text by mistake. Store the function object itself, without quotes and without parentheses:

def say_hello():
    return "hello!"

handlers = {"greet": say_hello}
print(handlers["greet"]())
hello!

If the key itself might be missing, you get a different error; see my KeyError guide.

Cause 10: A missing comma in a list (with a SyntaxWarning)

names = [
    "Ana"
    ("Ben")
]
c11_missing_comma.py:2: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
  "Ana"
Traceback (most recent call last):
  File "c11_missing_comma.py", line 2, in <module>
    "Ana"
    ~~~~~
    ("Ben")
    ^^^^^^^
TypeError: 'str' object is not callable

Without the comma, "Ana" ("Ben") reads as calling the string "Ana". Python 3.8 and later spot this at compile time and print a SyntaxWarning that even suggests the missing comma, as the What's New in Python 3.8 page describes. Read warnings at the top of your output; they often point straight at the bug.

The same error with int, float, None, list and dict

for bad in (5, 2.5, None, [1], {"a": 1}):
    try:
        bad()
    except TypeError as e:
        print(e)
'int' object is not callable
'float' object is not callable
'NoneType' object is not callable
'list' object is not callable
'dict' object is not callable

Two classic int versions: naming a variable sum, and writing maths without the *:

sum = 0
print(sum([1, 2, 3]))
Traceback (most recent call last):
  File "c13_sum.py", line 2, in <module>
    print(sum([1, 2, 3]))
          ~~~^^^^^^^^^^^
TypeError: 'int' object is not callable
total = 2(3 + 4)
c12_missing_star.py:1: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?
  total = 2(3 + 4)
Traceback (most recent call last):
  File "c12_missing_star.py", line 1, in <module>
    total = 2(3 + 4)
TypeError: 'int' object is not callable

Only the type name changes. 'NoneType' object is not callable usually means a variable you expected to hold a function holds None, often because a function forgot to return another function. JavaScript has the same family of errors, covered in my guide to TypeError: x is not a function.

Quick fix table

What you wroteWhy it failsFix
str = "hello" ... str(42)A variable hides the built-in str()Rename the variable, e.g. text
input = "yes" ... input()A variable hides input()Rename it, e.g. answer
self.name = ... ; def name(self)The attribute replaces the methodGive the method a different name
obj.status() # propertyA property already returns the valueobj.status
greeting(name)Parentheses after a stringgreeting + " " + name or an f-string
price ("12.50")Missing + between two stringsprice + "12.50"
"Hi {}"("Ana")Forgot .format"Hi {}".format("Ana")
handlers["greet"]()The dict holds a string, not a functionStore the function itself
"Ana"\n("Ben")Missing comma in a list"Ana", "Ben"

The exceptions reference lists TypeError as the error for an operation applied to an object of the wrong type.

Frequently asked questions

What does 'str' object is not callable mean?

You put parentheses after a name that holds a string, so Python tried to call the string like a function. Usually a variable named str, input or similar hides the built-in function.

How do I fix str object is not callable after naming a variable str?

Rename the variable to something like text, then restart your notebook kernel or rerun the script. In an interactive session, del str also restores the built-in.

Why does my class method say str object is not callable?

An instance attribute with the same name as the method replaces it. self.name = ... hides a method called name. Give the method or the attribute a different name.

Should I call a property with parentheses?

No. A @property returns its value when accessed, so use obj.status, not obj.status(). Calling it tries to call the returned value.

What does SyntaxWarning: 'str' object is not callable; perhaps you missed a comma mean?

Python found a string literal followed by parentheses, which is almost always a missing comma in a list or tuple. Add the comma between the items.

Why do I get 'int' object is not callable?

The same reasons: a variable named like a function, such as sum = 0 followed by sum(...), or a missing * in maths like 2(3 + 4). Use 2 * (3 + 4).

How can I check whether something can be called?

Use callable(x). It returns True for functions, classes and objects with __call__, and False for strings, numbers and lists.

Last checked: 9 November 2026. Figures, settings and guidance can change, so confirm anything important with the sources linked above.

Share X LinkedIn WhatsApp Facebook
Was this helpful?

0%