It's because when there are more than one nodes that have the same non-unique name, Maya sees them as this:
|group1|test |group2|test |group3|test So it can't find "test" anymore. Even though you are casting it as a variable, there is some bug. This bug only seems to occur for locators. Is there a reason you aren't using unique names? If you do need non-unique names, then this works: Rename the locator after creation. for x in range(10): grp = pm.group(em=True) t = pm.spaceLocator() pm.rename(t, 'test') pm.parent(t, grp) On Thu, Mar 5, 2015 at 6:37 PM, Marcus Ottosson <[email protected]> wrote: > I had a good look at this, and it looks to be quite the interesting quirk. > :) > > Here’s the same problem in maya.cmds. > > from maya import cmds > for x in range(2): > grp = cmds.group(em=True) > t = cmds.polySphere(n='test')[0] > assert isinstance(grp, unicode) > assert isinstance(t, unicode) > cmds.parent(t, grp) > > Merely replacing polySphere with spaceLocator causes the error for me in > Maya 2015, and I have no idea why. > > Good find! > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODHPmSgwZkj-uh8%3DswwjnZjL9jR8wXXu0EvsEbXRXwp9Q%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODHPmSgwZkj-uh8%3DswwjnZjL9jR8wXXu0EvsEbXRXwp9Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAHUba0KvGyF8euXkmh0HZEpfqhXAMM%2BpfRr-wX%2BeJjZigKcwaw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
