I am using PyMel to create some locators in a scene. I give the locator a 
name at creation and parent the locator to a group. The second iteration of 
the script I get a MayaNodeError (Maya Node does not exist (or is not 
unique)).

This behaviour seems a little bit weird to me. If I do the same but instead 
create a polyCube it works as expected. I could use various workarounds, 
for instance parent and then rename, which works fine...

This is some sample code to reproduce the error:
# polyCube, works fine
for x in range(10):
    grp = pm.group(em=True)
    t = pm.polySphere(n='test', ch=False)[0]
    pm.parent(t, grp)
    

# Error: MayaNodeError: Maya Node does not exist (or is not unique):: 
u'test'
for x in range(10):
    grp = pm.group(em=True)
    t = pm.spaceLocator(n='test')
    pm.parent(t, grp)
    

# workaround
for x in range(10):
    grp = pm.group(em=True)
    t = pm.spaceLocator()
    pm.parent(t, grp)
    t.rename('test')


Does anyone have an idea why this does not work?

Best Regards,
Johan

-- 
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/777f2425-3929-4364-a42e-594e1bb9bf94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to