I am porting my Maya tool from python2 to python3 and ran into an issue where I have been using set()
to remove duplicate entries in a list. Previously this worked great, but now I am getting:
TypeError: unhashable type: 'MeshUV'
The lists contain pymel MeshUV objects and might look like this:
[MeshUV('Right_Hand.map[1011]'), MeshUV('Right_Hand.map[1012]'),
MeshUV('Right_Hand.map[1013]'), MeshUV('Right_Hand.map[1014]')]
Klaus D asked for minimal code to get this error, so use this in Maya with some uvs selected.
import pymel.core as pm
uvs = pm.ls(sl=True, fl=True)
set(uvs)
I don't know why this is suddenly a problem, but maybe there's any fast alternative to using set to remove duplicates or if I can alter the lists somehow to make them work again?
Edit: So after martineau's response I am thinking it's a change in Maya 2022 and rather than python3 per se, even though this is the version of Maya when they made the switch.