# Script error with system.alarm.queryStatus

**URL:** <https://forum.inductiveautomation.com/t/script-error-with-system-alarm-querystatus/34013>\
**Category:** Ignition\
**Created:** [April 17, 2020, 3:58pm UTC](https://forum.inductiveautomation.com/t/script-error-with-system-alarm-querystatus/34013 "2020-04-17T15:58:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rs326](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rs326/32/4500_2.png) [@rs326](https://forum.inductiveautomation.com/u/rs326)\
**Post date:** [April 17, 2020, 3:58pm UTC](https://forum.inductiveautomation.com/t/script-error-with-system-alarm-querystatus/34013/1 "2020-04-17T15:58:51Z")

</div>

I think I am having the same issue

```auto
alarmEvents = system.alarm.queryStatus(displaypath =[event.source.parent.getComponent('AlarmHi').toolTipText.replace("\"","") + "*",event.source.parent.getComponent('AlarmLo').toolTipText.replace("\"","") + "*",event.source.parent.getComponent('AlarmHiHi').toolTipText.replace("\"","") + "*",event.source.parent.getComponent('AlarmLoLo').toolTipText.replace("\"","") + "*"],state=["ActiveUnacked","ClearUnacked"])

```

This above line works in some places but not others.

I get an error

```auto
Traceback (most recent call last):
  File "<event:mouseReleased>", line 35, in AckAlarm
AttributeError: 'NoneType' object has no attribute 'replace'

	at org.python.core.Py.AttributeError(Py.java:207)
	at org.python.core.PyObject.noAttributeError(PyObject.java:1032)
	at org.python.core.PyObject. __getattr__ (PyObject.java:1027)
	at org.python.pycode._pyx171.AckAlarm$1(<event:mouseReleased>:45)
	at org.python.pycode._pyx171.call_function(<event:mouseReleased>)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)
	at org.python.core.PyFunction. __call__ (PyFunction.java:413)
	at org.python.core.PyFunction. __call__ (PyFunction.java:408)
	at com.inductiveautomation.factorypmi.application.script.builtin.WindowUtilities$JyPopupMenu.actionPerformed(WindowUtilities.java:911)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Ignition v8.0.10 (b2020031912)
Java: Azul Systems, Inc. 11.0.6

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 17, 2020, 4:16pm UTC](https://forum.inductiveautomation.com/t/script-error-with-system-alarm-querystatus/34013/2 "2020-04-17T16:16:52Z")

</div>

The stacktrace is doing it’s best to tell you what’s wrong; one of the `toolTipText` properties is `None`, rather than an empty string, some of the time you’re calling your script. You could isolate your calls by spacing them out, which might help you get a more accurate line number for the error:

```auto
alarmEvents = system.alarm.queryStatus(
	displaypath =[event.source.parent.getComponent('AlarmHi').toolTipText.replace("\"","") + "*"
		, event.source.parent.getComponent('AlarmLo').toolTipText.replace("\"","") + "*"
		, event.source.parent.getComponent('AlarmHiHi').toolTipText.replace("\"","") + "*"
		, event.source.parent.getComponent('AlarmLoLo').toolTipText.replace("\"","") + "*"
	]
	, state=["ActiveUnacked","ClearUnacked"]
)

```

Or, you can break out the logic and more easily add a ‘safe’ substitution (Python’s `None` is a ‘false-ey’ value, and inline `or` will return the second value if the first is false):

```auto
def getFilter(component):
	return (event.source.parent.getComponent(component).toolTipText or "").replace('"', '') + '*'

components = ['AlarmHi', 'AlarmLo', 'AlarmHiHi', 'AlarmLoLo']

alarmEvents = system.alarm.queryStatus(displaypath =[getFilter(component) for component in components], state=["ActiveUnacked","ClearUnacked"])

```

---

<div class="post-metadata">

**Author:** ![rs326](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rs326/32/4500_2.png) [@rs326](https://forum.inductiveautomation.com/u/rs326)\
**Post date:** [April 17, 2020, 5:53pm UTC](https://forum.inductiveautomation.com/t/script-error-with-system-alarm-querystatus/34013/3 "2020-04-17T17:53:10Z")

</div>

Thanks Paul,

The second approach works.
