Jump to content

error with qt


mohamaedkamal

Recommended Posts

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 by mohamaedkamal
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...