I am using 8.3.1 and the file upload on a perspective page to parse a csv file (standard csv file comma separated), I found plenty of posts on here on how others have done it.
Here’s my simple code on the file received to test as it keeps not liking dict reader, whats right in front of me that I’m missing?
def runAction(self, event):
import csv
fileContents = event.file.getString("UTF-8")
reader = csv.DictReader(StringIO(fileContents))
I wanted to use the dict reader functions so I can have dictionaries of the data but it keeps telling me the following error. Seems like it not importing csv? Any suggestions?
java.lang.Throwable: Traceback (most recent call last):
File "<function:runAction>", line 4, in runAction
AttributeError: 'com.inductiveautomation.ignition.common.script.Pro' object has no attribute 'DictReader'
at org.python.core.Py.AttributeError(Py.java:176)
at org.python.core.PyObject.noAttributeError(PyObject.java:965)
at org.python.core.PyObject.__getattr__(PyObject.java:959)
at org.python.pycode._pyx537.runAction$1(<function:runAction>:5)
at org.python.pycode._pyx537.call_function(<function:runAction>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function___call__(PyFunction.java:474)
at org.python.core.PyFunction.__call__(PyFunction.java:469)
at org.python.core.PyFunction.__call__(PyFunction.java:464)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:851)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:833)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:1167)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1003)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:1249)
at com.inductiveautomation.perspective.gateway.script.SessionScriptFunctionHelper.execute(SessionScriptFunctionHelper.java:98)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:103)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:70)
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:80)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:262)
at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:251)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:220)
at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:58)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Throwable: AttributeError: 'com.inductiveautomation.ignition.common.script.Pro' object has no attribute 'DictReader'
... 30 more
Ignition v8.3.1 (b2025102109)
Java: Azul Systems, Inc. 17.0.16