Hi All.
Ignition 8.1.1 (b2020120808)
I have a strange thing happening when running a script in the internalFrameActived event of my window
When I open the window I get:-
Traceback (most recent call last):
File "<event:internalFrameActivated>", line 23, in <module>
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
The code is pretty straight forward
headers = ["Device Name","Status"]
data = []
window = system.gui.getParentWindow(event).getComponentForPath('Root Container')
indevs = system.dataset.toPyDataSet(window.inputdevices)
for row in indevs:
id = row["value"]
desc = row["DeviceName"]
#read the status of the associated tag index
if id < 32:
ok = window.safetyfunction_hmi.SDI_OK_0_31
fp = window.safetyfunction_hmi.SDI_FP_0_31
else:
ok = window.safetyfunction_hmi.SDI_OK_32_63
fp = window.safetyfunction_hmi.SDI_FP_32_63
id = id - 32
#make the bit
id_mask = 2 ** id
#see if this bit is on
# try:
ok_bit = (ok & id_mask)
fp_bit = (fp & id_mask)
#set the text
if fp_bit > 0:
data.append([desc,"Fault"])
elif ok_bit > 0:
data.append([desc,"OK:"])
else:
data.append([desc,"Tripped:"])
# except:
# data.append([desc,"Pending:"])
# pass
system.gui.getParentWindow(event).getComponentForPath('Root Container.Table').data = system.dataset.toDataSet(headers,data)
safetyfunction_hmi is a UDT parameter and line 23 where the error occurs is “ok_bit = (ok & id_mask)”
Any reference to the UDT returns a NoneType including the meta data.
Now it gets pretty strange, if I add a system.gui.messageBox(“Test”,“Test”) before the for loop. The code works perfectly fine.
(similarly adding the code to a button on the window works perfectly fine too)
Any info greatly appreciated
Regards
Dave