Python TypeError: What It Means and How to Fix the Common Ones
A TypeError means you used a value of the wrong type for the operation — adding a string to an int, calling something that isn't callable, or passing the wrong number of arguments. The message says which.
Python stops with a TypeError:
TypeError: can only concatenate str (not "int") to str
A TypeError means an operation received a value of a type it can't work with. Python is telling you the what precisely — the trick is knowing the handful of shapes these take. Here are the ones you'll actually hit.
'can only concatenate str (not "int") to str'
You tried to + a string and a number:
age = 25
print("Age: " + age) # ❌ str + int
+ won't mix types. Convert, or use an f-string:
print("Age: " + str(age)) # explicit conversion
print(f"Age: {age}") # cleaner — f-string handles it
The mirror image, TypeError: unsupported operand type(s) for +: 'int' and 'str', is the same problem from the other side — usually reading a number from input (which is always a str) without int(...).
'object is not callable'
TypeError: 'list' object is not callable
You put () after something that isn't a function — often because a variable shadowed a built-in:
list = [1, 2, 3]
nums = list(range(5)) # ❌ 'list' is now your variable, not the type
Rename the variable (items, not list). The same happens if you name a variable str, dict, sum, etc. — never shadow built-ins.
'missing N required positional arguments' / 'takes N but M given'
The function call doesn't match its signature:
def greet(name, greeting): ...
greet("Ada") # ❌ missing 'greeting'
Pass the right number of arguments. A very common variant in classes is forgetting self:
class Dog:
def bark(): # ❌ no self
print("woof")
Dog().bark() # TypeError: bark() takes 0 args but 1 given
Add self: def bark(self):.
'NoneType object is not subscriptable' / 'not iterable'
You indexed or looped over None — usually a function that returned nothing:
data = my_dict.get("key") # returns None if key missing
first = data[0] # ❌ None is not subscriptable
A function with no return gives back None. Check the value before using it, and make sure functions return what you think they do.
How to read any TypeError
The last line names the operation and the offending type. Work backwards from the traceback's bottom frame — that's your line — and ask: "what type did this actually get, versus what it needed?" A quick print(type(x)) above the failing line settles it instantly.
The checklist
can only concatenate str→ convert withstr()or use an f-string.not callable→ you shadowed a built-in or added()to a non-function.missing/takes N arguments→ fix the call; in methods, don't forgetself.NoneType is not subscriptable/iterable→ something returnedNone; guard it.- Print
type(x)above the failing line to confirm the real type.
Frequently Asked Questions
What does 'can only concatenate str (not "int") to str' mean?
You tried to join a string and an integer with +. Python won't auto-convert. Wrap the number in str() ("Age: " + str(age)) or use an f-string (f"Age: {age}").
Why do I get 'object is not callable'?
You put parentheses after something that isn't a function — commonly a variable that shadows a built-in like list or str. Rename the variable so the built-in name is free again.
What causes 'NoneType' object errors?
A value is None when you used it as if it weren't — indexing it, iterating it, or accessing an attribute. Usually a function returned None (no return, or a .get() miss). Check the value before you use it.
Stop reading, start building
This pairs with a hands-on BytExplorer course — do it on your own machine and actually keep the skill.