Table Of Contents
In this post, we cover 4 verified fixes for the Typeerror: ‘list’ Object Is Not Callable error- plus we dig into the forums to find even more solutions.
If you often use the Python programming language, then you’ve most likely come across the Typeerror: ‘list’ Object Is Not Callable error.
This is a pretty common error that a lot of programmers would see especially if they’re beginners. Luckily though, the Typeerror: ‘list’ Object Is Not Callable Python error isn’t that hard to fix.
All you have to do is know the causes of the error message and how you can fix it.
(You can see the error in the wild from the Team Tree House forums below:)
What is the Typeerror: ‘list’ Object Is Not Callable Error
In order to be able to fix the Typeerror: ‘list’ Object Is Not Callable Python error, you must first know what it is. To keep it simple, this is an error that appears if you want to create a list but end up using a function. You see, Python uses the symbols () for functions which aren’t applicable for lists. For coders who are used to the older type of programming languages, the () can be used for lists.
For Python, however, it’s an entirely different case. In order to get rid of the Typeerror: ‘list’ Object Is Not Callable message, you have to make some adjustments to your coding. Of course, this isn’t the only cause for this type of error (although it’s one of the main ones).
Dealing With Common Python Errors
In the video below, the YouTuber discusses a few of the basics to debugging.
In his videos, he says, he gets a great deal of questions for help where individuals have errors and aren’t certain exactly what the issue is. If they employed a few incredibly basic debugging processes, they would recognize how apparent the answer is.
More often than not, the issue is a typo, followed closely by a misconception concerning indentation and standards.
How to Fix the Typeerror: ‘list’ Object Is Not Callable Error
There are also other errors in the coding that may contribute to this type of error. Fortunately, this error isn’t that hard to fix. All you have to do is know what to change in the code. Here are some tips on how to do that:
It’s very important that you note the certain code changes in Python.
As mentioned above, the () is used for functions. Instead of extracting the elements in a list using a (), you have to use square brackets which look like . To fix that, follow these steps as per the recommendation of community members in Super User:
- Look for your list in the coding, for example: numbers (0)
- Change the () to  so it will look like this: numbers 
- Do the same with other lists that you have in your code
If ever you do the above fix and you still don’t get the results you want, then it’s most likely something to do with the file name.
According to some community members in Stack Over Flow, the filename cannot be the same name as any of the functions or methods in the code. Using the above sample, follow these steps:
- Check the file name of your program
- If the file name is “numbers”, change it to something else
- Check if the program is working
If you do these two fixes at the same time, your program should be able to work already.
Another funny thing about this error message is that there are times when it will pop out even if you’re not using a list.
Such is the case for one user in Daniweb wherein he tried to put data from a text file to an SQL table.
Although there is no list, Typeerror: ‘list’ Object Is Not Callable Python error message still appeared. To get a better idea of what he was facing, his coding was:
import MySQLdb, csv, sys
conn = MySQLdb.connect (host = “localhost”,user =
“a”, passwd = “b”,db = “c”)
c = conn.cursor()
csv_data = csv.reader(file(‘TxtFile1.txt’, ‘r’))
for row in csv_data: print row
row = csv_data.next()
c.execute(“INSERT INTO a (Category, Value) VALUES (%s, %s)”, row)
One of the answers, which was quite effective, was made by one of Daniweb’s community members. Here’s what was suggested:
- Take a look at the csv_data = csv.reader(file(‘TxtFile1.txt’, ‘r’)) line
- Take out the ‘r’ so that the code will be csv_data = csv.reader(file(‘TxtFile1.txt’))
- Check if the issue was already fixed
If you still have some problems with the error, then here are other quick solutions that you can try as suggested by a community member from Linus Tech Tips:
- Include a for-loop in list attributes
- Remove all the values that are outside of the list’s range
- Turn the main attribute of the list as a global variable to avoid any more errors
These are just some quick solutions that you can try if ever you’re still having some problems. However, the methods that were given above are sure to work anyway. These are just a few extras that you can throw in if ever you want to.
To find out more about TypeError: ‘list’ object is not callable, we search through several Python tech forums and discussion boards. In general, people wanted to know about TypeError: ‘list’ object is not callable Python, TypeError: ‘list’ object is not callable map, TypeError: ‘list’ object is not callable flash, and TypeError: ‘list’ object is not callable ranges.
They also were interested in TypeError: ‘list’ object is not callable str and pandas.
A person said that he was trying to run a code, which had a list of lists. However, he received a TypeError: ‘list’ object is not callable when he tried to add inner lists.
- The user got in touch with the Python community, and they explained to him that he had been using the wrong types of brackets.
- Since he wanted to access the elements of his lists, he had to use square brackets.
- That helped him a lot because he had been using parentheses ones. Once he fixed them, he was able to run the script.
A Python forum poster shared that if you are using parenthesis brackets, you call a function. That’s why you have to use square ones to avoid the TypeError: ‘list’ object is not callable.
Another user comments that you might run into the TypeError: ‘list’ object is not callable if you have another variable with the same name.
- He adds that what you have to do to resolve this error is change the names.
- The user also warns that you must be careful not to switch the places of the function and the argument, or you’ll get an error.
A person mentions that you might receive the TypeError: ‘list’ object is not callable when you name your list a function.
- Since the list is not a function and it’s not callable, you get a type error.
- The computer owner said that this is one of the most common error notice Python users make and that you have to go carefully over your script to find where you’ve made the mistake.
Another individual commented that he had just started learning how to program in Python and he kept getting TypeError: ‘list’ object is not callable. He asked for advice from the more experienced users in the Python forum. They explained to him that he might be shadowing the built-in name ‘list’ and that’s why he was getting that error.
A computer user says that the easiest way to avoid showing a built-in name and getting an error is to employ an integrated development environment, for example, PyCharm. It will highlight any name shadowing, and you won’t lose hours looking over your code looking for the mistake.
Another individual also remarks that using a built-in name as a variable will lead to TypeError: ‘list’ object is not callable when you attempted to run the script. He adds that you must have overwritten the value of the name and that the fix is a simple one – renaming the overwritten variable.
A person shares that you should avoid variable such as ‘list,’ ‘range,’ ‘dict,’ or ‘str.’ He also advised that you read more about built-in names in Python and that you take a look at PEP8 – the official Python style guide, which will help you name your variables correctly.
A computer user states that attributes and methods can’t share the same name and that when you give an attribute the same name as a method, you will get an error. That’s because you hide the method behind the attribute.
Another Python novice reported that he was working on a multi-index data frame. However, he kept getting TypeError: ‘list’ object is not callable. He consulted advanced Python users, and they explained that he must have used ‘list’ as a variable somewhere in the code and that he should go through it again.
A forum poster mentioned that he had to freshen up the basic dictionary rules and that he had to pay close attention to the types of brackets he was using. He had used the wrong brackets, and he was feeling very stupid when he posted his question on the Python forum, and they pointed out his mistake right away.
Another forum member pointed out that he was trying to create a program that will add items to a list. However, after he wrote the code, he kept getting an error saying that the ‘list’ object is not callable. After much discussion with his fellow members, he realized his mistake and was able to fix his code.
Python is a little bit more different than the usual programming language, that’s why there are a lot of people who are having quite a bit of difficulty getting used to the language. In fact, one of the most common mistakes would be using () instead of  for lists (this was mentioned in the 1st fix above).
If ever you’re seeing the Typeerror: ‘list’ Object Is Not Callable error message, then it’s most likely because of that reason. If it is that reason, then adjusting the code would be pretty easy to do (all you have to do is change all the lists’ parentheses into brackets). If ever this isn’t the case, then you may also use the other fixes to help determine and address the issues. The 2nd and 3rd fixes will show you situations wherein the brackets aren’t the main problem. Rather, the problem is caused by another factor.
The 4th fix, though, is more of a quick and dirty way to fix the problem – fixing it manually in a sense. Therefore, if you don’t like to look for problems in the code, you can use this fix just to restructure everything.
In any case, you can avoid this error if you have the basic knowledge in Python coding and dictionaries. If you are a beginner though, just try out the methods that we have listed above. These are some of the most common fixes for the most common problems that people have actually experienced and have fixed.
Ryan is a computer enthusiast who has a knack for fixing difficult and technical software problems. Whether you’re having issues with Windows, Safari, Chrome or even an HP printer, Ryan helps out by figuring out easy solutions to common error codes.