Python 'Sets' in Ignition

Hello,

I am attempting to verify that a system.tag.writeBlocking function successfully wrote to every tag in the list.
It works on one of my scripts that was writing to 50+ tags, but i wrote a similiar script (with only 3 tag writes) and when I cast the results of the writeBlocking function into a python set (which should only populate with unique values), I am getting a length of 2 (length should be equal to 1 if all quality code results == ‘Good’ )

Identical code in both scripts:

writeResult = system.tag.writeBlocking(tagPaths,tagVals,5000)
print writeResult
print set(writeResult)

Print results of the two functions below:

[Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good]
set([Good])
containerClear() successful: 239
-------
[Good, Good, Good]
set([Good, Good])
workcenterSet(45830) failed: 78

QualityCode doesn’t implement hashCode() so I wouldn’t expect it to play well with sets.

Would a possible solution be to cast the list as a list of strings first?

How about this:

allGood = all(result.isGood() for result in writeResult)
1 Like

That works wonderfully, that way i wouldn’t have to worry about casting the list as a string.
Thanks Kevin