I have Python method for a recursive depth traversal of tags, first mostly copy pasted from an example I found somewhere.
it works on on small amounts of tags, stay less than 50 tags, however I am now trying to run it on a folder that has 60 UDTs in it with 20 UDTs inside each one of those for a total of 3 layers and 1200 ish tags, and it hangs and never completes. I have it set to print each tag so I can watch its progress, so I know it is hanging because it will just stop on a tag and just sit there.
Basically, All I need is a list of all the tags that are nests under a Tag Path / Folder / UDT Instance
Is there a better way to do this that won’t hang? and is faster?
def browseTags(path, filt):
try:
results = system.tag.browse(path, filt)
returnResult = []
for result in results.getResults():
# If the item has children, call the function to repeat the process but starting at the child.
if result['hasChildren'] == True:
try:
returnResult.extend(browseTags(result['fullPath'], filt))
except:
print("Failed on Path: " + result['fullPath'])
else:
print("Tag Found: "+ str(result))
returnResult.append(result)
except:
print("Failed on Path: " + path)
print("Result: " + str(results))
return returnResult