Python Forum
You have any idea, how fix TypeError: unhashable type: 'list'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
You have any idea, how fix TypeError: unhashable type: 'list'
#1
from pcpartpicker import API

You have any idea, how to print api.supported_parts where

api = API()

You have any idea, how fix TypeError: unhashable type: 'list'??????????????

Python 3.8.6 (c:\users\lwdls\appdata\local\programs\python\python38\python.exe)
>>> %Run pcpartpicker5.py
Traceback (most recent call last):
File "D:\DOWNLOADS\Textbooks - Source Code\Python 3 Thonny IDE\pcpartpicker5.py", line 4, in <module>
from pcpartpicker import API
TypeError: unhashable type: 'list'
>>>


[Image: h2I81SjQmfr6EA]
Reply
#2
Please, post the full code (minimal reproducible example) as well as full traceback you get.
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Jun-01-2021, 07:21 PM)lsepolis123 Wrote: from pcpartpicker import API

You have any idea, how to print api.supported_parts where

api = API()

You have any idea, how fix TypeError: unhashable type: 'list'??????????????

Python 3.8.6 (c:\users\lwdls\appdata\local\programs\python\python38\python.exe)
>>> %Run pcpartpicker5.py
Traceback (most recent call last):
File "D:\DOWNLOADS\Textbooks - Source Code\Python 3 Thonny IDE\pcpartpicker5.py", line 4, in <module>
from pcpartpicker import API
TypeError: unhashable type: 'list'
>>>


[Image: h2I81SjQmfr6EA]

Now this is just a guess, but I would guess that a list is not a hashable entity.

From:

https://docs.python.org/3/glossary.html#term-hashable

Quote:Most of Python’s immutable built-in objects are hashable; mutable containers (such as lists or dictionaries) are not; immutable containers (such as tuples and frozensets) are only hashable if their elements are hashable. Objects which are instances of user-defined classes are hashable by default. They all compare unequal (except with themselves), and their hash value is derived from their id().

Yep, lists are not hashable.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unhashable error - Histogram code lsbpython 1 958 Aug-07-2022, 04:02 PM
Last Post: Yoriz
  search a list or tuple for a specific type ot class Skaperen 8 1,854 Jul-22-2022, 10:29 PM
Last Post: Skaperen
  TypeError: unsupported operand type(s) for +: 'dict' and 'int' nick12341234 1 9,207 Jul-15-2022, 04:04 AM
Last Post: ndc85430
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,763 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  TypeError: unsupported opperand type(s) for %: 'int' and 'list' cool_person 7 2,096 May-07-2022, 08:40 AM
Last Post: ibreeden
  unsupported operand type(s) for %: 'list' and 'int' RandomCoder 4 32,706 May-07-2022, 08:07 AM
Last Post: menator01
  TypeError: list indices must be integers or slices, not range Anldra12 2 2,501 Apr-22-2022, 10:56 AM
Last Post: Anldra12
  TypeError: __str__ returned non-string (type tuple) Anldra12 1 7,326 Apr-13-2021, 07:50 AM
Last Post: Anldra12
  What type of *data* is the name of a list/tuple/dict, etc? alloydog 9 4,255 Jan-30-2021, 07:11 AM
Last Post: alloydog
Question dict value, how to change type from int to list? swissjoker 3 2,692 Dec-09-2020, 09:50 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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