I have a portion of code I’m running in a gateway event script (trimmed out for clarity):
if initialChange:
from sys import exit
exit(0)
tagPath = 'Daicel/DSSA_AZ/NB/A5/SN_Req/'
#Get the variables. Use a readAll for efficiency
tags = ['Year', 'Type', 'SN']
vals = map(lambda x: tagPath + x, tags)
logger.debug("vals: %s" % vals)
but I recieve this exception when it runs:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 16, in File "", line 16, in NameError: global name 'tagPath' is not defined
However; this block of code runs without exception:
if initialChange:
from sys import exit
exit(0)
tagPath = 'Daicel/DSSA_AZ/NB/A5/SN_Req/'
#Get the variables. Use a readAll for efficiency
tags = ['Year', 'Type', 'SN']
vals = map(lambda x: 'Daicel/DSSA_AZ/NB/A5/SN_Req/' + x, tags)
logger.debug("vals: %s" % vals)
Also If I run the code in the script console, with the reference to tagPath, I don’t have a problem either.
I don’t really understand why the gateway event script has a problem with the first block of code here…