I had the following error while writing a file to a drive on the Gateway Server, through a script called by a Gateway Timer. This is the first time we’ve seen this error, although the system is young. It left an empty file in the folder which caused quite a bit of grief. Any ideas what could have gone wrong? What can I do to ensure that the file is written correctly? My first thought is to encapsulate the file write in a try…except, and if the exception comes up, delete the file if it exists and try again on the next timer scan. Would this work. Is there a more full-proof and sophisticated solution?
7:35:05 AM
TimerScriptTask
Error executing global timer script: tmrMain @250ms . Repeat errors of this type will be logged as ‘debug’ messages.
Traceback (most recent call last):
File “<TimerScript:IFI_12430_StackingCell/tmrMain @250ms >”, line 5, in
File “module:Robot”, line 157, in WriteFile
IOError: File ‘\172.18.1.1\StackingPoints\PartData.txt’ doesn’t exist or isn’t a file.
at org.python.core.PyException.fillInStackTrace(PyException.java:70)
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.Exception.<init>(Unknown Source)
at java.lang.RuntimeException.<init>(Unknown Source)
at org.python.core.PyException.<init>(PyException.java:46)
at org.python.core.PyException.<init>(PyException.java:43)
at org.python.core.PyException.<init>(PyException.java:61)
at org.python.core.Py.IOError(Py.java:182)
at com.inductiveautomation.ignition.common.script.builtin.FileUtilities.writeFile(FileUtilities.java:133)
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:422)
at org.python.core.PyObject.__call__(PyObject.java:426)
at org.python.pycode._pyx22.WriteFile$1(<module:Robot>:180)
at org.python.pycode._pyx22.call_function(<module:Robot>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
at org.python.core.PyFunction.__call__(PyFunction.java:307)
at org.python.pycode._pyx5.f$0(<TimerScript:IFI_12430_StackingCell/tmrMain @250ms >:8)
at org.python.pycode._pyx5.call_function(<TimerScript:IFI_12430_StackingCell/tmrMain @250ms >)
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:548)
at com.inductiveautomation.ignition.common.script.TimerScriptTask.run(TimerScriptTask.java:93)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)