berkhak Posted June 18, 2019 Share Posted June 18, 2019 Hi gents, I have been having trouble figuring this out; so I have 2 ways of deleting children of a subnet/object network with python and they both work in H17.0.352 but I am getting the following errors in H17.5.285: For 'destroy' within a loop: Error Python error: Traceback (most recent call last): File "", line 17, in File "", line 14, in destroy_geo File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.285/houdini/python2.7libs\houpythonportion\ui.py", line 850, in decorator return func(*args, **kwargs) File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.285/houdini/python2.7libs\hou.py", line 9715, in destroy return _hou.Node_destroy(*args) OperationFailed: The attempted operation failed. Cannot delete nodes while cooking For 'deleteItems': Python error: Traceback (most recent call last): File "", line 13, in File "", line 8, in clean_stale_geometry File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.285/houdini/python2.7libs\hou.py", line 9125, in deleteItems return _hou.Node_deleteItems(*args) OperationFailed: The attempted operation failed. Cannot delete nodes while cooking Here is the script and the hip folder: #Destroy node = hou.pwd() geo = hou.node('/obj/' + str(node.parent())) objimport = hou.node('/obj/' + str(node.parent()) + '/IMPORT_GLTF') def list_geometry_imports( subnet ): list = [] for n in subnet.allSubChildren(): list.append(n) return list def destroy_geo(list): for n in list: n.destroy() destroy_geo(list_geometry_imports(objimport)) #DeleteItems node = hou.pwd() geo = hou.node('/obj/' + str(node.parent())) objimport = hou.node('/obj/' + str(node.parent()) + '/IMPORT_GLTF') def clean_stale_geometry( subnet ): #print '\t' + str(subnet.children()) subnet.deleteItems( subnet.children() ) clean_stale_geometry(objimport) I need a fresh pair of eyes; please let me know if you have any ideas about why this is not working in 17.5. I didn't had much luck with the interweb... Thank you, Berk. python_deleteItems_test.hip Quote Link to comment Share on other sites More sharing options...
Andr1 Posted June 21, 2019 Share Posted June 21, 2019 I happen to have the same issue. Did your eventually find a fix? cheers Quote Link to comment Share on other sites More sharing options...
Andr1 Posted June 21, 2019 Share Posted June 21, 2019 (edited) I found a solution for my case: I wanted a python node to destroy a specific node. I created a parameter button on another node, with a callback script that would destroy the node on button press. Then I called the parm button inside the python node and invoked .pressButton() Every time the python cook it will try to press the button. It seems to be important to have both nodes (python and button node) disconnected from each other, otherwise it would trigger again the same error. See attached file, maybe can help you Cheers python_destroyItem.hiplc Edited June 21, 2019 by Andr1 Quote Link to comment Share on other sites More sharing options...
berkhak Posted July 23, 2019 Author Share Posted July 23, 2019 Yes, I happen to separate the actions as well. It does seem like Side Effects tag this behavior to a illegal operation. This env variable will stop the error from popping up but I dont think it is recommended: HOUDINI_ERROR_ON_ILLEGAL_NODE_EDITS := 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.