When I am adding some code I would like to wrap it in a try: except:
I am sure that I just don’t get the concept.
My goal is if I make and error in the code, when it runs the line of code that if it errors it goes it puts a -1 in the Value. and if there is an error with the tag that it does not return “None”
The script console appears to return a “-1” if I mispell the tag. and if the is and error with the tag it returns a “None”
it never seems to run the except code.
try:
Value = system.tag.read("SLI/Charlotte Emerald/Line 1/Bagger A/Ign_Machine_Running").value
except:
Value = -99
I don’t think system.tag.read() ever throws an exception. It returns a qualified value where the .quality property will be relevant if you provide an invalid tag path or whatever. The shortcut to tack .value on the end is only appropriate when supplying tested, static tagpaths.