Jump to content

NameError: name 'hou' is not defined


art3mis

Recommended Posts

Can any Python experts tell me why I get

Quote


  File "hou.session", line 9, in <module>
NameError: name 'hou' is not defined

with the following script entered in the Python Source Editor?

def set_opencl(parent_node, parm_value):
    for node in parent_node.allSubChildren():
        for p in node.parms():
            if p.name()=='opencl':
                try:
                    p.set(parm_value)
                except hou.PermissionError: #this handles the case that the parm is inside of a locked .otl
                    pass
hou.session.set_opencl(hou.node('/obj/sim'),1);

Houdini 16.0.597 Indie in Linux

Edited by art3mis
Link to comment
Share on other sites

 That is a long-standing "bug", if you didn't put import hou  in hou.session module, it will work until first error (any python exception), once you get an error, hou module gets lost for some reason. So, just always do import hou.

 

Edited by Stalkerx777
  • 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...