Maya2020 MayaNodeError

Maya2020 MayaNodeError

Anonymous
Not applicable
1,748 Views
3 Replies
Message 1 of 4

Maya2020 MayaNodeError

Anonymous
Not applicable

In Maya2020, when running:

```

import pymel.core as pm
sphere1 = pm.polySphere()[0]
sphere2 = pm.polySphere()[0]

geo_iter = iter([sphere1, sphere2])
print geo_iter.next().root()

```

 

It will raise error: MayaNodeError: file C:\...\maya\2020.1.0\platform-windows\vc_redist_2017-14.1\maya\Python\lib\site-packages\pymel\core\nodetypes.py line 1323: Maya Node does not exist (or is not unique):: u'None' # 

 

But In Maya2018, it will return `sphere1 ` with no error.

1,749 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

myPyNode.root() always produces the None error in 2020 as soon as it is evaluated as a string

import pymel.core as pm

myNode = pm.PyNode('pSphere1')
print(myNode)
myRoot = myNode.root()
print('No Crash Yet')
print(myNode.root())
print('Already Crashed')

0 Likes
Message 3 of 4

Anonymous
Not applicable

Ugly patch to get your root:
myPyNode.longName().split('|')[1]

0 Likes
Message 4 of 4

Anonymous
Not applicable
myPyNode.getParent(-1)

is cleaner, thanks for the feedback 🙂