Jump to content
morn66

Python: Delete node

Recommended Posts

Hi everyone,

I try to delete a node with a python script but it doesn't work.

In sop, I have a geo node name "deleteMePython". There is also another geo node call "pythonScript" that have a python node inside.

That's the script that I used on the python "node":

pythonNode = hou.node("/obj/deleteMePython")
pythonNode.destroy()

I attached the simple file to show you what is it.

Thanks :D 

pythonDelete.hiplc

Share this post


Link to post
Share on other sites

Hi there,

It's working for me and it's deleting the node as expected. Please note that the node gets cooked only when there's some change.  Is it not deleting even if you force cook it ? 

-J

Share this post


Link to post
Share on other sites

Are you using Houdini 17.5 ? I have seen this error in 17.5 but works in 17.0. It could be a bug. Probably worth submitting an RFE.  

-J

Share this post


Link to post
Share on other sites

well that error suggests that you are deleting nodes by cooking things :P

I can understand if you write a shelf tool in python to do something like that,
or maybe a post-render script in a ROP node,
but I'm really curious what kind of thing you want to achieve with this,
as it indeed sounds like something that is not without risk

Share this post


Link to post
Share on other sites

Yeah I use 17.5.

What I want to achieve is to automatically create a subnet node with a bunch of node inside based on a folder directory and when created, the subnet has a specific name. So far, everything works well.

My only bug is that I want python to delete the subnet if it already exist before running the other script, because if I don't, the name of the new subnet will be "nameOfSubnet1" and I don't want that. I know that I can just delete the subnet before running my script, but I'm lazy and I want python to do it for me

Share this post


Link to post
Share on other sites

instead of deleting, can't you just check if it already exists, and skip the creation if it already does?

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×