Jump to content

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


Latimerias

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.

Link to comment
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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...