Python Forum

Full Version: TypeError: 'list' object is not callable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
please give a runnable sample of your code with the full error text or a clear description of the problem
aTuple = ('xyz', 'zara', 'abc')
aList = list(aTuple)
print ("List elements : ", aList)
Traceback (most recent call last):
File "C:/python/program/list.py", line 56, in <module>
main()
File "C:/python/program/list.py", line 51, in main
aList = list(aTuple)
TypeError: 'list' object is not callable
It may help if you post what OS you are running and the version of python you've installed.
Your code works ok on both python2.7 and python 3.6 on linux

python test.py
('List elements : ', ['xyz', 'zara', 'abc'])

python3 test.py
List elements : ['xyz', 'zara', 'abc']

So I think this could be your python installation.
looks like list was overloaded.
(you named something list)
Quote:File "C:/python/program/list.py", line 51, in main

Bye doing this you are overwriting the build in list()
Change to eg my_list.py.
Working on python 3.6. Thank you.