mohamaedkamal Posted May 23, 2017 Share Posted May 23, 2017 (edited) I have some error when I extract some data from dops to adding this data in qlist using python qt def print_seltected (self): node = hou.selectedNodes() node.name() "AttributeError: 'tuple' object has no attribute 'name'" Edited May 23, 2017 by mohamaedkamal Quote Link to comment Share on other sites More sharing options...
f1480187 Posted May 23, 2017 Share Posted May 23, 2017 Not a PySide2, just an ordinary HOM error. Try "hou.selectedNodes()[0]". hou.selectedNodes() returns tuple containing node objects: (node0, node1, ...). If you need first element from it (node0), use hou.selectedNodes()[0]. If one node is selected, it will be tuple of one element: (node0, ), so, you still need to access it like a tuple. If nothing is selected, empty tuple will be returned (,) and accessing it's first element will raise an error. You may want to add a check for it's content, for example "if hou.selectedNodes():" block will work. 1 Quote Link to comment Share on other sites More sharing options...
mohamaedkamal Posted May 23, 2017 Author Share Posted May 23, 2017 I want to use an hou.node methods like node.parm() it's make the same error Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted May 25, 2017 Share Posted May 25, 2017 hou.selectedNodes() returns a tuple of nodes not a single node. for n in hou.selectedNodes(): print n.name() 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.