Tagvalue read fault

image
I need read all this folder’s tag value

pathList=[]
results = system.tag.browse(path = '[Malu OPC tags]Slitter/MaterialJob/Cut1', filter = {})
for result in results.getResults():
    path=result[u'fullPath']
    pathList.append(path)
    
Values = system.tag.readBlocking(pathList)   

I have try this code, but it report fault

23:10:14.167 [AWT-EventQueue-0] ERROR com.inductiveautomation.ignition.client.util.gui.ErrorUtil - <HTML>Error executing script for event:&nbsp;<code><b>actionPerformed</b></code><BR>on component:&nbsp;<code><b>Return</b></code>.
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last):
  File "<event:actionPerformed>", line 7, in <module>
TypeError: expected a str

	at org.python.core.Py.TypeError(Py.java:236)
	at org.python.core.PyObject.asString(PyObject.java:4078)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.extractTagPaths(AbstractTagUtilities.java:398)
	at

how to modify the code ? thanks a lot

Try changing line 7 to
pathList.append(str(path))
With out the string conversion you get something like this:
[[default]_types_, [default]Machine1, [default]Machine 2, etc.]

With the string conversion you get

[
  '[default]_types_', 
  '[default]Machine1', 
  '[default]Machine 2', 
  '[default]oneShot', 
  '[default]oneShotLatch', '[default]Scanner', 
  '[default]ScannerTimestamp', '[default]Ski lift speed', 
  '[default]statusBit']
  [
    [null, Bad_Unsupported, Sun May 15 09:22:08 BST 2022 (1652602928212)], 
    [null, Bad_Unsupported, Sun May 15 09:22:08 BST 2022 (1652602928212)], 
    [null, Bad_Unsupported, Sun May 15 09:22:08 BST 2022 (1652602928212)], ...
  ]
]

You can post your code into the Script Console to test it. (That’s how I tested it.)

1 Like

thanks , it works