Session module > AttributeError: 'NoneType' object has no attribute foo

   5902   1   1
User Avatar
Member
350 posts
Joined: June 2016
Offline
Trying to enable OpenCL globally by editing the session module. This is my exact implementation

import hou;
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/dopnet1'), 1);

But get the following error message. have googled but no solution so far. Can any Python experts help?
The attempted operation failed.
Traceback (most recent call last):
File “hou.session”, line 10, in <module>
File “hou.session”, line 2, in set_opencl
AttributeError: ‘NoneType’ object has no attribute ‘allSubChildren’
Edited by art3mis - April 23, 2017 11:20:22
User Avatar
Member
8525 posts
Joined: July 2007
Offline
that would probably happen if you don't have /obj/dopnet1 node in your scene
so make sure it exists
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links