Python Forum
TypeError: 'list' object is not callable
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: 'list' object is not callable
#1
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
Reply
#2
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.
Reply
#3
looks like list was overloaded.
(you named something list)
Reply
#4
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.
Reply
#5
Working on python 3.6. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: cannot pickle ‘_asyncio.Future’ object Abdul_Rafey 1 269 Mar-07-2024, 03:40 PM
Last Post: deanhystad
  error in class: TypeError: 'str' object is not callable akbarza 2 445 Dec-30-2023, 04:35 PM
Last Post: deanhystad
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 679 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  TypeError: 'NoneType' object is not callable akbarza 4 920 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,261 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 777 Jul-23-2023, 02:25 PM
Last Post: Fare
  TypeError: 'float' object is not callable #1 isdito2001 1 1,045 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  TypeError: a bytes-like object is required ZeroX 13 3,838 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  'SSHClient' object is not callable 3lnyn0 1 1,125 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,373 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020