Jump to content
Latimerias

Python "invalid node name" when trying to use variable as name

Recommended Posts

I have a tuple that I'm looping over like this: 'for name in tuple:'. Inside the loop I say something like createNode('group', name) but I get the error "invalid node name". Please help I am not sure why this is as it returns a string properly elsewhere! I also tried the .setName but got the same result.

Share this post


Link to post
Share on other sites

Perhaps your name is invalid?

I run all my names through this function before attempting to use them as node names.

import re
def returnValidHoudiniNodeName(passedItem):
    # Thanks to Graham on OdForce for this function!
    # Replace any illegal characters for node names here.
    return re.sub("[^0-9a-zA-Z\.]+", "_", passedItem)

 

Edited by Atom
  • Thanks 1

Share this post


Link to post
Share on other sites

Ah yes there was a weird name i found, clumsy mistake. Thanks for the function as well works perfectly!

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

×