You appear to have a list of lists. Try:

Copy",".join(str(x) for x in data)
Answer from marr75 on Stack Overflow
🌐
Career Karma
careerkarma.com β€Ί blog β€Ί python β€Ί python typeerror: β€˜list’ object is not callable solution
Python typeerror: β€˜list’ object is not callable Solution | Career Karma
December 1, 2023 - Take a look at the error type: TypeError. This is one of the most common types of Python errors. It tells us we’re trying to manipulate a value using a method not available to the type of data in which the value is stored. Our error message tells us that we’re trying to call a Python list object.
🌐
Tutorial Teacher
tutorialsteacher.com β€Ί python β€Ί error-types-in-python
Error Types in Python
Learn about built-in error types in Python such as IndexError, NameError, KeyError, ImportError, etc.
Discussions

python - Why does "example = list(...)" result in "TypeError: 'list' object is not callable"? - Stack Overflow
I tried to use this code from a tutorial at the REPL: example = list('easyhoss') The tutorial says that example should become equal to a list ['e', 'a', 's', 'y', 'h', 'o', 's', 's']. But I got an... More on stackoverflow.com
🌐 stackoverflow.com
Python keeps throwing a "TypeError" error for a list, and I do not understand why - Stack Overflow
So, I'm kind of new to Python, and I'm trying to make a small command line menu system with lists, using the following code: menu = ["item1", "item2", "item3", "item4"] i = 0 for item in menu2: ... More on stackoverflow.com
🌐 stackoverflow.com
python - TypeError: 'list' object is not callable while trying to access a list - Stack Overflow
I am trying to run this code where I have a list of lists. I need to add to inner lists, but I get the error TypeError: 'list' object is not callable. Can anyone tell me what am I doing wrong her... More on stackoverflow.com
🌐 stackoverflow.com
Tuple throwing unexpected TypeError error when holding list
The below code is throwing a TypeError. my_list = [1,2] my_tuple = (my_list,) my_tuple[0] += [3,4] print(my_tuple) However when I simply put the result of indexing the tuple in a holder, it magically works. my_list = [1,2] my_tuple = (my_list,) holder = my_tuple[0] holder += [3,4] print(my_tuple) ... More on discuss.python.org
🌐 discuss.python.org
0
0
March 13, 2023
🌐
Python
docs.python.org β€Ί 3 β€Ί library β€Ί exceptions.html
Built-in Exceptions β€” Python 3.14.4 documentation
BaseException β”œβ”€β”€ BaseExceptionGroup β”œβ”€β”€ GeneratorExit β”œβ”€β”€ KeyboardInterrupt β”œβ”€β”€ SystemExit └── Exception β”œβ”€β”€ ArithmeticError β”‚ β”œβ”€β”€ FloatingPointError β”‚ β”œβ”€β”€ OverflowError β”‚ └── ZeroDivisionError β”œβ”€β”€ AssertionError β”œβ”€β”€ AttributeError β”œβ”€β”€ BufferError β”œβ”€β”€ EOFError β”œβ”€β”€ ExceptionGroup [BaseExceptionGroup] β”œβ”€β”€ ImportError β”‚ └── ModuleNotFoundError β”œβ”€β”€ LookupError β”‚ β”œβ”€β”€ IndexError β”‚ └── KeyError β”œβ”€β”€ MemoryError β”œβ”€β”€ NameError β”‚ └── UnboundLocalError β”œβ”€β”€
Top answer
1 of 11
189

Seems like you've shadowed the builtin name list, which points at a class, by the same name pointing at an instance of it. Here is an example:

>>> example = list('easyhoss')  # here `list` refers to the builtin class
>>> list = list('abc')  # we create a variable `list` referencing an instance of `list`
>>> example = list('easyhoss')  # here `list` refers to the instance
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'list' object is not callable

I believe this is fairly obvious. Python stores object names (functions and classes are objects, too) in namespaces (which are implemented as dictionaries), hence you can rewrite pretty much any name in any scope. It won't show up as an error of some sort. As you might know, Python emphasizes that "special cases aren't special enough to break the rules". And there are two major rules behind the problem you've faced:

  1. Namespaces. Python supports nested namespaces. Theoretically you can endlessly nest them. As I've already mentioned, they are basically dictionaries of names and references to corresponding objects. Any module you create gets its own "global" namespace, though in fact it's just a local namespace with respect to that particular module.

  2. Scoping. When you reference a name, the Python runtime looks it up in the local namespace (with respect to the reference) and, if such name does not exist, it repeats the attempt in a higher-level namespace. This process continues until there are no higher namespaces left. In that case you get a NameError. Builtin functions and classes reside in a special high-order namespace __builtins__. If you declare a variable named list in your module's global namespace, the interpreter will never search for that name in a higher-level namespace (that is __builtins__). Similarly, suppose you create a variable var inside a function in your module, and another variable var in the module. Then, if you reference var inside the function, you will never get the global var, because there is a var in the local namespace - the interpreter has no need to search it elsewhere.

Here is a simple illustration.

>>> example = list("abc")  # Works fine
>>> 
>>> # Creating name "list" in the global namespace of the module
>>> list = list("abc")
>>> 
>>> example = list("abc")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
>>> # Python looks for "list" and finds it in the global namespace,
>>> # but it's not the proper "list".
>>> 
>>> # Let's remove "list" from the global namespace
>>> del list
>>> # Since there is no "list" in the global namespace of the module,
>>> # Python goes to a higher-level namespace to find the name. 
>>> example = list("abc")  # It works.

So, as you see there is nothing special about Python builtins. And your case is a mere example of universal rules. You'd better use an IDE (e.g. a free version of PyCharm, or Atom with Python plugins) that highlights name shadowing to avoid such errors.

You might as well be wondering what is a "callable", in which case you can read this post. list, being a class, is callable. Calling a class triggers instance construction and initialisation. An instance might as well be callable, but list instances are not. If you are even more puzzled by the distinction between classes and instances, then you might want to read the documentation (quite conveniently, the same page covers namespaces and scoping).

If you want to know more about builtins, please read the answer by Christian Dean.

P.S. When you start an interactive Python session, you create a temporary module.

2 of 11
40

Before you can fully understand what the error means and how to solve, it is important to understand what a built-in name is in Python.

What is a built-in name?

In Python, a built-in name is a name that the Python interpreter already has assigned a predefined value. The value can be either a function or class object. These names are always made available by default, no matter the scope. Some of the values assigned to these names represent fundamental types of the Python language, while others are simple useful.

As of the latest version of Python - 3.6.2 - there are currently 61 built-in names. A full list of the names and how they should be used, can be found in the documentation section Built-in Functions.

An important point to note however, is that Python will not stop you from re-assigning builtin names. Built-in names are not reserved, and Python allows them to be used as variable names as well.

Here is an example using the dict built-in:

>>> dict = {}
>>> dict
{}
>>>

As you can see, Python allowed us to assign the dict name, to reference a dictionary object.

What does "TypeError: 'list' object is not callable" mean?

To put it simply, the reason the error is occurring is because you re-assigned the builtin name list in the script:

list = [1, 2, 3, 4, 5]

When you did this, you overwrote the predefined value of the built-in name. This means you can no longer use the predefined value of list, which is a class object representing Python list.

Thus, when you tried to use the list class to create a new list from a range object:

myrange = list(range(1, 10))

Python raised an error. The reason the error says "'list' object is not callable", is because as said above, the name list was referring to a list object. So the above would be the equivalent of doing:

1, 2, 3, 4, 5)

Which of course makes no sense. You cannot call a list object.

How can I fix the error?

Suppose you have code such as the following:

list = [1, 2, 3, 4, 5]
myrange = list(range(1, 10))

for number in list:
    if number in myrange:
        print(number, 'is between 1 and 10')

Running the above code produces the following error:

Traceback (most recent call last):
  File "python", line 2, in <module>
TypeError: 'list' object is not callable

If you are getting a similar error such as the one above saying an "object is not callable", chances are you used a builtin name as a variable in your code. In this case and other cases the fix is as simple as renaming the offending variable. For example, to fix the above code, we could rename our list variable to ints:

ints = [1, 2, 3, 4, 5] # Rename "list" to "ints"
myrange = list(range(1, 10))

for number in ints: # Renamed "list" to "ints"
    if number in myrange:
        print(number, 'is between 1 and 10')

PEP8 - the official Python style guide - includes many recommendations on naming variables.

This is a very common error new and old Python users make. This is why it's important to always avoid using built-in names as variables such as str, dict, list, range, etc.

Many linters and IDEs will warn you when you attempt to use a built-in name as a variable. If your frequently make this mistake, it may be worth your time to invest in one of these programs.

I didn't rename a built-in name, but I'm still getting "TypeError: 'list' object is not callable". What gives?

Another common cause for the above error is attempting to index a list using parenthesis (()) rather than square brackets ([]). For example:

>>> lst = [1, 2]
>>> lst(0)

Traceback (most recent call last):
  File "<pyshell#32>", line 1, in <module>
    lst(0)
TypeError: 'list' object is not callable

For an explanation of the full problem and what can be done to fix it, see TypeError: 'list' object is not callable while trying to access a list.

🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί handling-typeerror-exception-in-python
Handling TypeError Exception in Python - GeeksforGeeks
August 22, 2025 - a = ["Geeky", "GeeksforGeeks", ... print("TypeError: Check list of indices") ... Explanation: when "2" (a string) is used as a list index, Python raises a TypeError....
Find elsewhere
🌐
Python.org
discuss.python.org β€Ί python help
Tuple throwing unexpected TypeError error when holding list - Python Help - Discussions on Python.org
March 13, 2023 - The below code is throwing a TypeError. my_list = [1,2] my_tuple = (my_list,) my_tuple[0] += [3,4] print(my_tuple) However when I simply put the result of indexing the tuple in a holder, it magically works. my_list = …
Top answer
1 of 2
13

What is a TypeError?

It means exactly what it sounds like: there is an Error that is caused by the Type of one or more of the values in the code.

... but what is a "type"?

In a Python program, every object has a type. By "object" (equivalently in Python, "value") we mean something that can be given a name in the source code. Most names are simple variables: if we write x = 1, then 1 is an object, it has a name x, and its type is int - the type itself has a name.

"Type" means more or less what it sounds like: it tells you what kind of thing something else is. 1, 2 and 3 are all integers; they have the same type, int. You can think of it as representing the concept of an integer.

Not every type has a built-in name. For example, functions are objects (most other languages don't work this way!), and they have a type, but we can't directly refer to that type by name in our code.

Every type does have a representation as an object, however, whether it's named or not. You can use the built-in type to get such a "type object":

>>> type(1) # the result from this...
<class 'int'>
>>> int # is the same:
<class 'int'>
>>> type(int) # We can look a bit deeper:
<class 'type'>
>>> def func():
...     pass
>>> type(func) # and get types that aren't named:
<class 'function'>
>>> type(type) # and there's this special case:
<class 'type'>

Notably, the type of type is type itself.

You may notice that Python (3.x) displays these type objects with the word class. This is a useful reminder: when you create a class, you are defining a new type of data. That is the purpose of classes.

What do messages like this mean?

We can break the examples down into a few categories:

TypeError: func() takes 0 positional arguments but 1 was given
TypeError: func() takes from 1 to 2 positional arguments but 3 were given
TypeError: func() got an unexpected keyword argument 'arg'
TypeError: func() missing 1 required positional argument: 'arg'
TypeError: func() missing 1 required keyword-only argument: 'arg'
TypeError: func() got multiple values for argument 'arg'
TypeError: MyClass() takes no arguments

These exceptions are telling you that the arguments (the things you put between the ()) for calling func (or creating an instance of MyClass) are wrong. Either there are too many, not enough, or they are not properly labelled.

This is admittedly a little confusing. We're trying to call a function, and the thing we're calling is a function - so the type does actually match. The identified problem is with the number of arguments. However, Python reports this as a TypeError rather than a ValueError. This might be in order to look more familiar to programmers from other languages such as C++, where "types" are checked at compile time and can be very complex - such that functions that accept different types or numbers of arguments, are themselves considered to have different types.

TypeError: unsupported operand type(s) for +: 'int' and 'str'
TypeError: can only concatenate str (not "int") to str
TypeError: '>' not supported between instances of 'int' and 'str'
TypeError: can't multiply sequence by non-int of type 'float'
TypeError: string indices must be integers

These exceptions are telling you that the left-hand side and right-hand side of an operator (a symbol like + or > or ^, used to compute a result) don't make sense. For example, trying to divide or subtract strings, or repeat a string a non-integer number of times, or (in 3.x) compare strings to numbers. As a special case, you can use + between two strings (or lists, or tuples), but it doesn't "add" them in a mathematical sense. If you try to use + between an integer and a string, the error message will be different depending on the order.

TypeError: %d format: a number is required, not str
TypeError: not all arguments converted during string formatting

These ones are a bit tricky. The % operator is used to get the modulus (remainder when dividing numbers), but it can also be used to format strings by replacing some placeholders. (This is an outdated system that's hard to get right and has weird special cases; in new code, please use f-strings or the .format method.)

An error occurs because the placeholders in the string on the left-hand side don't match up with what's on the right-hand side. In the second case, it's likely that you actually wanted to calculate a modulus, so the left-hand side should be a number (most likely an integer) instead. It's debatable whether these should be ValueErrors instead, since it could be that the contents of the string are wrong. However, Python cannot read your mind.

TypeError: list indices must be integers or slices, not str

This is also a problem with an operator, this time the [] operator (used for indexing into a list, slicing a list, or looking up a key in a dictionary). A string makes sense inside the [] if we are looking up a key in a dictionary that has strings as keys; but we cannot index into a list with it.

TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
TypeError: a bytes-like object is required, not 'str'
TypeError: bad operand type for abs(): 'str'

These mean that something wrong was passed to a built-in function (or another callable, such as a type). Functions that you get from a library may raise their own TypeErrors with custom messages. The message should be pretty straightforward.

TypeError: descriptor 'to_bytes' for 'int' objects doesn't apply to a 'str' object

This one is very unusual, and most people who ask this question would never run into it (except maybe with the datetime standard library module). It happens because of trying to use a method as if it were a function, but giving it the wrong type of thing for self: for example, int.to_bytes('1'). The code is wrong because '1' is a string, and strings don't support .to_bytes. Python will not convert the string to integer; and it cannot give an AttributeError instead because to_bytes was looked up in the class, not on the string.

TypeError: 'int' object is not iterable
TypeError: cannot unpack non-iterable int object
TypeError: 'int' object is not callable
TypeError: 'int' object is not subscriptable

These mean exactly what they sound like. "iterable" means "able to be iterated"; i.e., checked repeatedly to get separate values. This happens in for loops, comprehensions and when trying to convert to list etc. The "unpack" variation of the message results from trying to use unpacking syntax on the non-iterable.

"callable" means "able to be called"; to "call" something is to write () after it (possibly with arguments between the ()). Code like 1('test') doesn't make sense because 1 isn't a function (or a type).

"subscriptable" means "able to be subscripted"; here, "subscripting" means either using slice syntax (x[1:2:3]), or indexing or looking for a key (x['test']). We can only do this with sequences (like lists or strings) and mappings (like dicts).

2 of 2
7

How can I understand and fix the problem?

First, look at the traceback to see where in the code the error occurs. If it's in a library, work backwards to the point where your code uses the library. Then read the error message carefully, and compare it to the code, to figure out what causes the complaint. Finally, think carefully: is the operation wrong, or the values?

Examples

(TODO)

Some non-obvious things

Reusing names

Did you perhaps reassign the name of a built-in callable, such as str or input or list? Did you try to reuse a name for two different things (for example, a function and some global data that it uses)?

Names in Python can only refer to one thing at a time. If you use, say, list as a variable name, then it isn't also the name of "the abstract concept of a list" any more, so you can't use it to create more lists (which includes converting other things to lists). If you create a global variable months with a list of strings, and then write a function months, the function replaces the list, and the function's code can't look up the list. This can easily happen accidentally when using from some_module import * syntax.

Similarly, if you try to make a class that uses the same name for an method as for a data attribute of the instances, that will cause the same problem. (There's also a tricky special case with @staticmethod).

Processing lists

Sometimes people expect to be able to use a list like a Numpy array, and "broadcast" an operation or a function call to each element of the list. That doesn't work. Use a list comprehension instead.

Handling None

Consider whether you need to handle None as a special case. But try to avoid getting into that situation in the first place; "special cases aren't special enough to break the rules", as they say.

Trying to use a library (including a standard library)

If something doesn't work like you'd expect (for example, trying to subtract datetime.times or serialize an instance of a user-defined class as JSON) - rather than trying to treat the problem as a debugging question, search for solutions for what you want that part of the code to do.

If the error mentions a 'str' type and you thought it should be a number

Did you get it from the input function? That gives you a str, even if it looks like a number. Please see How can I read inputs as numbers?.

If the error mentions a 'function' type or 'type' type

Did you forget to call the function, or create an instance of a class?


Error messages about wrong arguments

The error message will tell you the name of the function; so look at the part of the line that calls that function, and check the arguments. Is there a correct number of positional arguments? Is there a keyword argument that must be provided, and is missing? Is there a keyword argument that shouldn't be provided? Is there a positional argument that is also provided by keyword?

If you are writing a method for a class, remember to allow for self. It is necessary for instance methods. If you are calling a method, keep in mind that self will be counted as an argument (both for the amount "required" and the amount "given").

A common beginner error is attempting to use a method (which isn't a classmethod) from a class without instantiating it. You'd do something like

value = MyClass.method(things)

where you should be doing something like

instance = MyCLass()
value = instance.method(things)

which (obscurely) passes instance as the first (self) argument to method, and things as the second argument.

If you are using a callback that takes arguments from an indirect source, check the source.

If you are trying to create an instance of your own class, and get an TypeError from __init__, make sure that you actually wrote an __init__.

If you don't know what the arguments should be, check the documentation. If the arguments make sense, maybe the function is wrong - make sure you didn't confuse it for another one in the same library.

Error messages about operand types

Make sure the operator is correct for what you want the code to do (for example: ^ is not exponentiation; you want **), and then check the operand types.

In most cases, it will be appropriate to convert the type - but think carefully. Make sure the operation will make sense with the new types. For example, if the code is l + 'second', and l is a list that currently contains ['first'], chances are good we don't want to concatenate strings, but instead create a modified list that also has 'second' as an element. So actually we wanted to "add" another list: l + ['second'].

If string indices must be integers, it could be that the string being indexed is JSON or something of that sort, which should have been parsed already to create a dictionary (possibly with nested lists and dictionaries).

If list indices must be integers or slices, it's likely that the problem is with the list, rather than the index. If you expected the list to be a dict, check whether it contains a dict - especially if it contains exactly one element, which is a dict. Then check if that's the dict that should actually be looked into. If so, the solution is easy: simply add another level of indexing, in order to grab that dict first. This commonly happens when trying to grab data from parsed JSON.

Error messages about string formatting

Seriously, did you intend to do string formatting? If you do want to format a string, consider using f-strings or the .format method - these are easier to debug, and have fewer special cases. But more likely, the left-hand side is some string like '1' that should have been converted to int (or maybe float) first.

Error messages about a "descriptor"

Python's error message here is fairly cryptic - it's using terminology that most programmers rarely if ever have to worry about. But once recognized, the error is very easy to pattern-match. Take special care if the class can be instantiated with no arguments - an empty pair of parentheses () is still necessary to instantiate the class; otherwise, the code refers to the class itself. An instance is required in order to use methods.

Custom error messages from built-in functions

A "bad operand" for a "unary" operator (for example bad operand type for unary +: 'str') can be caused by a stray comma. 'a', + 'b' is not the same as 'a' + 'b'; it is trying to use + as a unary operator on the 'b' string, and then make a tuple. (You know how you can write e.g. -1 to get a negative number? The - there is a unary operator. It turns out you can similarly write +1; it means the same as 1, of course.)

Especially if you have had to migrate code from 2.x to 3.x, be very careful about the distinction between bytes and str types in 3.x. bytes represents raw data; str represents text. These are fundamentally different and unrelated things, and it is only possible to convert from one to the other by using an encoding. In Python 3.x, files that are opened in a binary mode (using 'b' in the mode string) produce bytes when read, and must be given something compatible with bytes when written to. str does not qualify; you must specify an encoding explicitly. The canonical for this problem is "TypeError: a bytes-like object is required, not 'str'" when handling file content in Python 3.

Error messages where something "is not" usable in some way

Did you want to use it that way?

Python can't read your intent. For example, accessing an element of a list is done using [], not (). If the code says () instead, that will be interpreted as an attempt to call the list, so the error message will complain that the list is not callable.

Not iterable

When something is not iterable, the problem is very likely with the thing, rather than the iteration. If you want a for loop to run a specific number of times, you still need something to iterate over; a range is the usual choice. The same is true if you are using a list comprehension etc. to make multiple copies of a value. If you have an integer x and you want to make a list with one item, which is that integer, that is spelled [x], not list(x).

It's especially common to see 'NoneType' object is not iterable. There is exactly one 'NoneType' object: the special value None - Python forbids creating any more instances of that class. Python methods that work in-place - especially list methods - generally return None rather than the list that was modified. See also TypeError: 'NoneType' object is not iterable in Python.

Not callable

If a 'module' object is not callable, it's most likely because you want a function or class from the module, that has the same name as the module, rather than the module itself. The linked example is for the socket standard library; other common cases include datetime and random.

Also make sure that the code doesn't call a function and remember the result, instead of remembering the function itself. This is a common problem with APIs that expect a "callback" function. (If you need to choose the arguments ahead of time, but not actually call the function, see How can I bind arguments to a function in Python? .) Sometimes people also try to provide the name of a function as a string, rather than providing the function itself.

Beginners sometimes expect to be able to do "implicit multiplication" in a mathematical formula, the way that it works in math class. In a Python program (like other popular languages), code like a(b + c) does not multiply the integer a by the result of b + c; it attempts to call a as if it were a function. See Why do I get "TypeError: 'int' object is not callable" from code like "5(side_length**2)"?.

Not subscriptable

Sometimes, people try to get "digits" from a number by indexing into it as if it were a string. int and float values aren't strings; they don't have digits in them. So this will cause a "is not subscriptable" TypeError. The numeric value is the same no matter what base you write them in, and there are other ways to write a number besides base ten; so it is your responsibility to create the appropriate string first.

If you are trying to work with nested lists, be careful about indexing into them. A list like example = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] should be indexed like example[i][j], not e.g. example[i[j]]. The logic here should be pretty simple: the correct code means to index into example (getting a list of integers), and then index into that result. The incorrect code means to use j as an index into i first, because of how the brackets are nested.

If you are trying to call a function or use a class (such as the built-in range), remember that this uses parentheses, not square brackets:

# WRONG
range[10]
# RIGHT
range(10)
Top answer
1 of 2
23

Before you can fully understand what the error means and how to solve, it is important to understand what a built-in name is in Python.

What is a built-in name?

In Python, a built-in name is a name that the Python interpreter already has assigned a predefined value. The value can be either a function or class object. These names are always made available by default, no matter the scope. Some of the values assigned to these names represent fundamental types of the Python language, while others are simple useful.

As of the latest version of Python - 3.6.2 - there are currently 61 built-in names. A full list of the names and how they should be used, can be found in the documentation section Built-in Functions.

An important point to note however, is that Python will not stop you from re-assigning builtin names. Built-in names are not reserved, and Python allows them to be used as variable names as well.

Here is an example using the dict built-in:

>>> dict = {}
>>> dict
{}
>>>

As you can see, Python allowed us to assign the dict name, to reference a dictionary object.

What does "TypeError: 'list' object is not callable" mean?

To put it simply, the reason the error is occurring is because you re-assigned the builtin name list in the script:

list = [1, 2, 3, 4, 5]

When you did this, you overwrote the predefined value of the built-in name. This means you can no longer use the predefined value of list, which is a class object representing Python list.

Thus, when you tried to use the list class to create a new list from a range object:

myrange = list(range(1, 10))

Python raised an error. The reason the error says "'list' object is not callable", is because as said above, the name list was referring to a list object. So the above would be the equivalent of doing:

1, 2, 3, 4, 5)

Which of course makes no sense. You cannot call a list object.

How can I fix the error?

If you are getting a similar error such as this one saying an "object is not callable", chances are you used a builtin name as a variable in your code. In this case the fix is as simple as renaming the offending variable. For example, to fix the above code, we could rename our list variable to ints:

ints = [1, 2, 3, 4, 5] # Rename "list" to "ints"
myrange = list(range(1, 10))

for number in ints: # Renamed "list" to "ints"
    if number in myrange:
        print(number, 'is between 1 and 10')

PEP8 - the official Python style guide - includes many recommendations on naming variables.

This is a very common error new and old Python users make. This is why it's important to always avoid using built-in names as variables such as str, dict, list, range, etc.

Many linters and IDEs will warn you when you attempt to use a built-in name as a variable. If your frequently make this mistake, it may be worth your time to invest in one of these programs.

I didn't rename a built-in name, but I'm still getting "TypeError: 'list' object is not callable". What gives?

Another common cause for the above error is attempting to index a list using parenthesis (()) rather than square brackets ([]). For example:

>>> lst = [1, 2]
>>> lst(0)

Traceback (most recent call last):
  File "<pyshell#32>", line 1, in <module>
    lst(0)
TypeError: 'list' object is not callable

For an explanation of the full problem and what can be done to fix it, see TypeError: 'list' object is not callable while trying to access a list.

2 of 2
-4

Here is the mcve!

>>> []()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable

Try also {}() and ()(). The message TypeError: 'X' object is not callable means that you wrote expression(some_arguments) where expression is an instance of the X type, and this type doesn't support to be used in a function call syntax. Most of the time you wrote this because you thought expression was a function or some other callable type.

🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 42652639 β€Ί typeerror-for-list
python - TypeError for list - Stack Overflow
"write" is expecting a string, and you are passing a list You can join the content, i.e: f1.write(' '.join(tokenixed))
🌐
Rollbar
rollbar.com β€Ί home β€Ί how to fix typeerror exceptions in python
How to Fix TypeError Exceptions in Python | Rollbar
October 1, 2022 - Incorrect list index type e.g. using a string as a list index value instead of an integer. Iterating on a non-iterative value e.g. trying to iterate on an integer. Here’s an example of a Python TypeError thrown when trying to add a string and an integer:
🌐
Real Python
realpython.com β€Ί ref β€Ί builtin-exceptions β€Ί typeerror
TypeError | Python’s Built-in Exceptions – Real Python
March 27, 2025 - >>> run_callback(42) Traceback (most recent call last): ... TypeError: callback must be callable ... In this tutorial, you'll get to know some of the most commonly used built-in exceptions in Python. You'll learn when these exceptions can appear in your code and how to handle them. Finally, you'll learn how to raise some of these exceptions in your code. ... Get a Python Cheat Sheet (PDF) and learn the basics of Python, like working with data types, dictionaries, lists, and Python functions:
🌐
Reddit
reddit.com β€Ί r/learnpython β€Ί β€˜list’ object is not callable error
'list' object is not callable error : r/learnpython
February 9, 2023 -

M = pow(C, d, N) #convert integer to a list of unicode values using the list that notes number of characters in each entry in original M = str(M) res = int() strt = 0 for size in seq:

# slicing for particular length
res.append(M[strt : strt + size])
strt += size

M = list(int(i) for i in res)

    #convert unicode values to list of characters

M = list(chr(i) for i in M)

    #convert list of characters into string that is the decrypted message


#Display decrypted message

print(M)

I keep getting the error in the title and I have no clue how to fix it. I’m sure it’s obvious to most of you, but I’m just starting and I’ve been piecing this together from repeated google searches.

🌐
Carleton University
cs.carleton.edu β€Ί cs_comps β€Ί 1213 β€Ί pylearn β€Ί final_results β€Ί encyclopedia β€Ί typeError.html
Error Encyclopedia | Type Error
For example, the multiplication ... >>> 1187228.3001583007 * 7 8310598.101108105 Β· A TypeError occurs in Python when you attempt to call a function or use an operator on something of the incorrect type....
🌐
Rollbar
rollbar.com β€Ί home β€Ί what are the different types of python errors? – and how to handle them
What are the Different Types of Python Errors? – and How to Handle Them
July 14, 2025 - This can happen either when you try to access an element that doesn't exist in the sequence or when you try to access an element at an index that is greater than or equal to the length of the sequence.