I learned system.tag.read and write have been replaced by system.tag.readBlocking and writeBlocking. I am wondering if there is a version of Ignition where, if we upgrade to said version, we need to worry about instances of the deprecated functions breaking entirely and needing to be rewritten? We are on version 8.1.18.
IA tends to keep deprecated functions around for a really long time. They just don't get much love if bugs pop up, and they are deliberately removed from the documentation.
I'd not worry about old code. If you make sure new code or updated code uses the modern functions, the deprecated stuff will likely be gone before it matters.
We'll also never remove functionality (outside of critical security issues) in a "minor" version - as in, any 8.1 upgrade is absolutely going to be fine. We have no plans to remove these specific functions in 8.3, either, meaning you're set for at least the next several years.
Awesome, thank you for the quick answers.
I googled "how to read single tag after system.tag.read deprecation" and ended up here so I'll revive this year-old discussion. Since this function was deprecated my scripting for getting the value from a single tag has gone from
tagVal = system.tag.read(tagPath).value
to
tagVal = [v.value for v in system.tag.readBlocking([tagPath])][0]
Is that the accepted way moving forward, or is there something simpler I could use?
I use
tagVal = system.tag.readBlocking([tagPath])[0].value
system.tag.readBlocking([tagPath])][0].value
While you could technically use:
system.tag.readBlocking(tagPath).value
if you learn to use the list forms, it will cover all your bases.
Use the list comprehension like above when you want to read a handful of tags together, and stuff them into separate variables. Like so:
tagA, tagB, tagC = [v.value for v in system.tag.readBlocking([pathA, pathB, pathC])][0]
Hi pturmel.
I agree, I used list comprehension in my proposal because it scales better into using a handful of tags, which is also common. So for consistency I use list comprehension even when it's just 1 tag.