Hi all,
Is there a problem with system.util.invokeLater? I keep getting this error even though my function runs fine with system.util.invokeAsynchronous. I was using 8.0.1 and then transferred over to an 8.0.2 rc from this past Friday.
I seem to be able to call it from the script console, and I feel like I have called it in vision before, but it fails in perspective (for reference, it is called on a property change script, but is located on a component’s script area).
Error message:
|SystemUtilities|20May2019 17:40:03|Error running function from system.util.invokeAsynchronous|
| --- | --- | --- |
|com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 47, in doAsynch AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'invokeLater'
at org.python.core.Py.AttributeError(Py.java:207)
at org.python.core.PyObject.noAttributeError(PyObject.java:1032)
at org.python.core.PyObject.__getattr__(PyObject.java:1027)
at org.python.pycode._pyx32.doAsynch$2(:47)
at org.python.pycode._pyx32.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:456)
at org.python.core.PyFunction.__call__(PyFunction.java:451)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:776)
at com.inductiveautomation.ignition.gateway.script.GatewaySystemUtilities.lambda$_invokeAsyncImpl$0(GatewaySystemUtilities.java:62)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 47, in doAsynch AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'invokeLater'
... 14 common frames omitted|
Sample script:
loadingLabel = self.parent.getChild("Options").getChild("Loading Label")
loadingLabel.props.text = "Loading Table..."
def doAsynch(site = site, deviceType = deviceType, loadingLabel = loadingLabel):
devices = shared.device.getDevices(site, deviceType)
deviceNames = devices["deviceNames"]
devicePaths = devices["devicePaths"]
deviceNames, devicePaths = shared.util.naturalSortLists(0, deviceNames, devicePaths)
data = []
headers = ["Device", "Device Path"]
for index, devicePath in enumerate(devicePaths):
deviceName = deviceNames[index]
devicePath = devicePaths[index]
tags = shared.device.getTags(devicePath)
tagNames = tags["tagNames"]
tagPaths = tags["tagPaths"]
tagNames = [tagName for tagName in tagNames if "SCADA" not in tagName]
tagPaths = [tagPath for tagPath in tagPaths if "SCADA" not in tagPath]
for tagIndex in range(len(tagPaths)):
tagPath = tagPaths[tagIndex]
tagName = tagNames[tagIndex]
if tagName not in headers:
headers.append(tagName)
data = []
for index, devicePath in enumerate(devicePaths):
data.append({})
for headerIndex, header in enumerate(headers):
if headerIndex == 0:
data[index][header] = deviceNames[index]
elif headerIndex == 1:
data[index][header] = devicePaths[index]
else:
data[index][header] = None
def doLater(component = self, loadingLabel = loadingLabel):
loadingLabel.props.text = ""
component.props.data = data
#component.makeColumnAttributes()
component.readData()
system.util.invokeLater(doLater)
system.util.invokeAsynchronous(doAsynch)
Any ideas? I don’t think it is scoping. Maybe something in my code is interfering with invokeLater? Or is this function removed?
Cheers,
Roger