Jump to content

How to search through CPIO data?


MJNorris

Recommended Posts

Hi there!

I'm looking at getting the most out of the hou.Node.saveItemsToFile() & hou.Node.loadItemsFromFile() functions, we're already using them to export/load node snippets, but I was hoping to use the hou.loadCPIODataFromString Function to scan through the file before loading it in.

The main idea being to check for node name clashes prio to loading, and then have a set of options to deal with that.

However I'm struggling to work out the "proper" way of converting that data into a python friendly format.

So far what I'm doing is this:

with open(cpio_file, "r") as f:
	CPIO_string = f.read()
  
CPIO_data = hou.loadCPIODataFromString(CPIO_string)

And that gives me what appears to be a massive tuple, full of other massive tuples, filled with raw strings.

I can search through them line by line but it feels wrong, very very wrong.

Is there some clever way of converting that data block into a python friendly format?

Any help is much appreciated!

Matt

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...