Pydataset has not attribute error

I get this error when trying to run this script, and not really sure what’s wrong here. There was another post regarding this code I cleaned up, I don’t remember anyone pointing out anything in regards to that.

Ignition 7.8.5
Error:

Traceback (most recent call last):
  File "<event:actionPerformed>", line 26, in <module>
AttributeError: 'com.inductiveautomation.ignition.common.script.Scr' object has no attribute 'toPyDataset'

	at org.python.core.Py.AttributeError(Py.java:173)
	at org.python.core.PyObject.noAttributeError(PyObject.java:930)
	at org.python.core.PyObject.__getattr__(PyObject.java:925)
	at org.python.pycode._pyx10.f$0(<event:actionPerformed>:39)
	at org.python.pycode._pyx10.call_function(<event:actionPerformed>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1275)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:631)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:590)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:170)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:265)
	at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
	at com.sun.proxy.$Proxy31.actionPerformed(Unknown Source)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.8.5 (b2016120813)
Java: Oracle Corporation 1.8.0_271

relevant script:

else:
    #Dictionary to place valve location dataset in.
    CRvalveTo = {}
    #Dataset of valve locations
    ValveDataset = system.dataset.toPyDataset(system.tag.read("System1/Project1/HOA/Valves").value)
    #Puts dataset into a dict
    for rowRead in ValveDataset:
        CRvalveTo[rowRead['id']] = rowRead['description']
    #Gets transfer location
    valveCrossx = CRvalveTo[valve]

Typo, it’s system.dataset.toPyDataSet, capital ‘S’.

1 Like

@Kevin.Herron typo strikes again!

Thanks

Not your fault. Our codebase and documentation are maddeningly inconsistent in when it comes to “Dataset” vs “DataSet”. Every mention on the doc page is “Dataset” or “PyDataset” except the function names, with are case sensitive “DataSet”.

Internally, the interface is Dataset, the Jython impl is PyDataSet, and all the other impls are a mix… :rage:

3 Likes