Home Forums Nazca unexpected errors: TypeError: unhashable type: ‘list’

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7006
    lomuc
    Participant

    is based in Eindhoven

    I recently upgraded my anaconda-spyder,  NAZCA (v0.5.13) and PDK environments to the latest versions. However, I’ve encountered an unexpected issue when attempting to run a Nazca MPW template.py. This is an error that I haven’t come across before with previous versions. Here’s the detailed error traceback:


    Traceback (most recent call last):

    File “—\MPW_template.py”, line 110, in <module>

    DC = {name:sp.sp_pad_dc_box().put(‘rc’, pin)

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    File “—\MPW_template.py”, line 110, in <dictcomp>

    DC = {name:sp.sp_pad_dc_box().put(‘rc’, pin)

    ^^^^^^^^^^^^^^^^^^

    File “—\anaconda3\Lib\site-packages\nazca\bb_util.py”, line 215, in wrapper

    if p in _hash_params.keys():

    ^^^^^^^^^^^^^^^^^^^^^^^^

    TypeError: unhashable type: ‘list’

    The lines in question from the script are as follows:

    MPWcell = CELL.put(0)
    sp.nazca_logo().put(500, 3500, scale=1.5)
    DC = {name:sp.sp_pad_dc_box().put('rc', pin)
    for name, pin in MPWcell.pin.items() if 'dc' in name}

    It appears that the compiler is having trouble recognizing the electrical pin items within ‘MPWcell’ as hashable data. I wanted to highlight that the original script template hasn’t been modified in any way. If anyone has insights into this issue, I would greatly appreciate your assistance. Perhaps there are potentially interesting things in the upgraded versions or relevant packages that are causing this problem. Thanks in advance.

    #7019
    Ronald
    Keymaster

    Dear Iomuc,

    A list object can not be used in Python as a dictionary key, as a list is mutable (it can change) after creation, like append, insert, pop etc. Only immutable objects can be hashed and serve as a key.

    Ronald

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.