The emails seem to be sending now, but there is an INDENT EOF error occurring after the script runs. I’m not sure if this is a cause for concern or how to prevent the error.
FWIW, this code is in a Gateway Event Timer Script contained within a for loop.
def sendEmail(tankNo=tankNo, tank = tank):
import system
recipients=["jane@test.com","jon@xyz.com"] #
system.report.executeAndDistribute(path="xyz", parameters = {"tankNumber":tankNo}, project="xyz", action= "email", actionSettings = {"to":recipients, "smtpServerName":"Mail Server", "from":"jon@xyz.com", "subject":tank + 'test email', "body":tank + " test "})
system.util.invokeAsynchronous(sendEmail)
print 'post-email function'
#end of gateway timer script
INFO | jvm 1 | 2019/07/24 09:51:50 | post-email function
INFO | jvm 1 | 2019/07/24 09:51:50 | W [r.Data ] [17:51:50]: Unable to compile script.
INFO | jvm 1 | 2019/07/24 09:51:50 | org.python.core.PySyntaxError: SyntaxError: ("mismatched input '<EOF>' expecting INDENT", ('<function:updateData>', 1, 29, 'def updateData(data, sample):\n'))
INFO | jvm 1 | 2019/07/24 09:51:50 |
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.ParserFacade.fixParseError(ParserFacade.java:92)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.ParserFacade.parse(ParserFacade.java:199)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.Py.compile_flags(Py.java:1751)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.ignition.common.script.ScriptManager.compileFunction(ScriptManager.java:689)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.ignition.common.script.ScriptManager.compileFunction(ScriptManager.java:673)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.reporting.gateway.data.ScriptReportDataSource.gatherData(ScriptReportDataSource.java:50)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.reporting.gateway.ReportingGatewayHook.getReportData(ReportingGatewayHook.java:338)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.reporting.gateway.ReportingGatewayHook.getReportData(ReportingGatewayHook.java:239)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.reporting.gateway.scripting.GatewayScriptingFunctions.executeAndDistribute(GatewayScriptingFunctions.java:290)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.reporting.common.scripting.ReportScriptingFunctionsPyWrapper.executeAndDistribute(ReportScriptingFunctionsPyWrapper.java:74)
INFO | jvm 1 | 2019/07/24 09:51:50 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2019/07/24 09:51:50 | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2019/07/24 09:51:50 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2019/07/24 09:51:50 | at java.lang.reflect.Method.invoke(Unknown Source)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:429)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyObject.__call__(PyObject.java:320)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.pycode._pyx156.sendEmail$1(<TimerScript:xyz/checkWorkHours10min @10,000ms >:64)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.pycode._pyx156.call_function(<TimerScript:xyz/checkWorkHours10min @10,000ms >)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyTableCode.call(PyTableCode.java:165)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyFunction.function___call__(PyFunction.java:376)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyFunction.__call__(PyFunction.java:371)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyFunction.__call__(PyFunction.java:361)
INFO | jvm 1 | 2019/07/24 09:51:50 | at org.python.core.PyFunction.__call__(PyFunction.java:356)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:647)
INFO | jvm 1 | 2019/07/24 09:51:50 | at com.inductiveautomation.ignition.gateway.script.GatewaySystemUtilities$1.run(GatewaySystemUtilities.java:69)
INFO | jvm 1 | 2019/07/24 09:51:50 | at java.lang.Thread.run(Unknown Source)
Is the updateData function the issue? If it is, I don’t where the function is located.