Error of scripts

in tag change script,i used script:

import system
value = newValue.value
system.tag.write(“rec_tag”,value)
system.gui.messageBox("This is new value: %d " % value)

but the script execute error, why?

error info:

[ERROR] 12:44:26 TagChangeScriptExecutor Error executing tag change script: scada_test/change

Traceback (most recent call last):
File “TagChangeScript:scada_test/change”, line 4, in
AttributeError: ‘com.inductiveautomation.ignition.common.script.Scr’ object has no attribute ‘gui’

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._pyx66.f$0(TagChangeScript:scada_test/change:4)
at org.python.pycode._pyx66.call_function(TagChangeScript:scada_test/change)
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:568)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:561)
at com.inductiveautomation.ignition.common.script.TagChangeScriptExecutor$TagChangeExecutionCallback.execute(TagChangeScriptExecutor.java:168)
at com.inductiveautomation.ignition.common.script.TagChangeScriptExecutor$TagChangeExecutionCallback.execute(TagChangeScriptExecutor.java:127)
at com.inductiveautomation.ignition.common.util.SerialExecutionQueue$PollAndExecute.run(SerialExecutionQueue.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Hi! Welcome to the forums!

Okay, the reason you’re getting this is because you’re running it as a Gateway Event Script. Gateway scripts don’t have any gui access.

Try moving it over to be a Client Event Script. :slight_smile: