I'm new to python and coding in general…
I'm playing with asCode method for nodes. Everything seems to be working fine unless I try to execute the code in another Houdini version.
For example, if the code is generated in Houdini 18 and then executed in Houdini 17 it will generate an AttributeError.
The reason is some parameters just don't exist on the same node in different Houdini versions, in particular attribute wrangle “vex_precision” parameter that only exists in Houdini 18.
So this is how error looks like when I execute the code in H17 that was generated in H18:
AttributeError: 'NoneType' object has no attribute 'lock'
And here is the block of code where error occurs:
# Code for /obj/geo1/subnet1/pointwrangle1/vex_precision parm if locals().get("hou_node") is None: hou_node = hou.node("/obj/geo1/subnet1/pointwrangle1") hou_parm = hou_node.parm("vex_precision") hou_parm.lock(False) hou_parm.deleteAllKeyframes() hou_parm.set("auto") hou_parm.setAutoscope(False)
I wonder if there is a way to bypass that error or anything that helps to fix this problem.
Thanks !