Return tag name script


i have made a csv file with some bunch of tags using “system.tag.browseTags” in a folder and i can get their values with “system.tag.readBlocking” and then with a for function with “.value”, but how can i get in my CSV file only the name of tag example:
Tank 1 – 120
instead of
[Edge]/tanks/tank 1 – 120


I’m not entirely sure what you’re trying to do, it seems like you are writing out to a file. Instead of using the full path you want only the actual tag name?

system.tag.browseTags() returns a list of BrowseTag objects, you can call the the name variable from that.

tags = system.tag.browseTags(parentPath="")

for tag in tags:

wow thank you! it works but; i could not pass it yet to an array, i tried that my CSV file dont show the paths.
i have something like this:
tags = system.tag.browseTags(parentPath=“folder”)
for tag in tags:
name_list.append( tags[tag].name )

but it gives me error about “TypeError: array.array indices must be integers”
PD sorry i did not know how to use the code format

either use three back ticks ``` before and after the code or the preformatted text option to enter code.

This is because tag isn't an integer, but an object of type browseTag

This should get you a list of names:

tags = system.tag.browseTags(parentPath='folder')
name_list = [ for tag in tags]
1 Like

thank you, thank yo so much for your time! it works :smiley: