0

Maybe someone can help me understand the following error:

values = {'material_ids': [(0,0,1),(0,0,2)]}
for mat in values.materials_ids:
    print(mat)

I get the error AttributeError: 'dict' object has no attribute 'material_ids'

Steff
  • 41
  • 6
  • 1
    That's just [not how you access dict members in python.](https://docs.python.org/3/tutorial/datastructures.html#dictionaries). Though this may also be of interest. https://stackoverflow.com/questions/2352181/how-to-use-a-dot-to-access-members-of-dictionary – msanford Jul 16 '21 at 16:25

1 Answers1

4

It means exactly what it says it means. The dictionary "values" has a key called "materials_ids", but no attribute (variable) named materials_ids.

try this instead:

for mat in values["materials_ids"]:
Ben Alan
  • 1,399
  • 1
  • 11
  • 27