I'm trying to run the below script. But for some reason I receive this error saying
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "Text", line 18, in <module>
File "Text", line 18, in <listcomp>
indexerror: bpy_prop_collection[index]: index 0 out of range, size 0
Below is the script I'm using and in the output it prints 1 only, so this means the error is in this statement labels = [ v.groups[0].group for v in mesh.vertices ]
So if anyone could please advise
import bpy
scn = bpy.context.scene
mesh_obj = scn.objects.active
mesh = mesh_obj.data
vertex_groups = mesh_obj.vertex_groups
print("1")
labels = [ v.groups[0].group for v in mesh.vertices ]
print("2")