Python Forum
TypeError: 'list' object is not callable - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: TypeError: 'list' object is not callable (/thread-4813.html)



TypeError: 'list' object is not callable - rajeev1729 - Sep-10-2017

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


RE: TypeError: 'list' object is not callable - cygnus_X1 - Sep-10-2017

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.


RE: TypeError: 'list' object is not callable - Larz60+ - Sep-10-2017

looks like list was overloaded.
(you named something list)


RE: TypeError: 'list' object is not callable - snippsat - Sep-10-2017

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.


RE: TypeError: 'list' object is not callable - rajeev1729 - Sep-10-2017

Working on python 3.6. Thank you.