# Script Failing Due to Trying to Add two Values

**URL:** <https://forum.inductiveautomation.com/t/script-failing-due-to-trying-to-add-two-values/12159>\
**Category:** Ignition\
**Created:** [September 23, 2016, 1:38pm UTC](https://forum.inductiveautomation.com/t/script-failing-due-to-trying-to-add-two-values/12159 "2016-09-23T13:38:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jreynolds](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jreynolds](https://forum.inductiveautomation.com/u/jreynolds)\
**Post date:** [September 23, 2016, 1:38pm UTC](https://forum.inductiveautomation.com/t/script-failing-due-to-trying-to-add-two-values/12159/1 "2016-09-23T13:38:35Z")

</div>

The script is failing when I try to add a value of 1 to the chart.releaseBank variable.

This is the script:

[code] value1=1  
chart.releaseBank = system.tag.read(chart.tagPath+“ReleaseBank”).value  
kitReleased = system.db.runScalarPrepQuery("  
SELECT TOP 1  
PH.PHID  
FROM  
PouHeader PH  
LEFT JOIN JobHeader JH ON PH.JobID = JH.JobID  
WHERE  
PH.StatusID = 1 AND  
PH.PouID = ?  
ORDER BY  
JH.SeqNumber ASC", [chart.pouID], chart.databaseName)

```
system.db.runPrepUpdate("UPDATE PouHeader SET StatusID = 8 WHERE PHID = ?", [kitReleased], chart.databaseName)
chart.releaseBank += 1
system.tag.write(chart.tagPath+"ReleaseBank", chart.releaseBank)[/code]

```

This is the console error:

[code] 8:30:09 AM ChartInstance Chart ‘Charlotte/EPS\_R1\_0\_0/ScannerHUD’ aborted in ‘Script[Step:KitRelease10]’

Traceback (most recent call last):  
File “”, line 25, in onStart  
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘int’

at org.python.core.Py.TypeError(Py.java:235)  
at org.python.core.PyObject.\_basic\_add(PyObject.java:2017)  
at org.python.core.PyObject.\_basic\_iadd(PyObject.java:2058)  
at org.python.core.PyObject.\_iadd(PyObject.java:2032)  
at org.python.pycode._pyx22195.onStart$1(:26)  
at org.python.pycode.pyx22195.call\_function()  
at org.python.core.PyTableCode.call(PyTableCode.java:165)  
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)  
at org.python.core.PyFunction.function\_\_\_call_(PyFunction.java:376)  
at org.python.core.PyFunction. **call** (PyFunction.java:371)  
at org.python.core.PyFunction. **call** (PyFunction.java:361)  
at org.python.core.PyFunction. **call** (PyFunction.java:356)  
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:639)  
at com.inductiveautomation.sfc.elements.steps.StepScriptRunner.invoke(StepScriptRunner.java:46)  
at com.inductiveautomation.sfc.elements.steps.StepScriptRunner.invoke(StepScriptRunner.java:34)  
at com.inductiveautomation.sfc.elements.steps.action.ActionStep.activateStep(ActionStep.java:48)  
at com.inductiveautomation.sfc.elements.StepContainer.onActivateRequested(StepContainer.java:125)  
at com.inductiveautomation.sfc.fsm.element.ElementInactive.action(ElementInactive.java:33)  
at com.inductiveautomation.sfc.fsm.element.ElementInactive.action(ElementInactive.java:8)  
at com.inductiveautomation.sfc.fsm.StateContext.lambda$handleEvent$0(StateContext.java:52)  
at com.inductiveautomation.sfc.api.ExecutionQueue$ThrowableCatchingRunnable.run(ExecutionQueue.java:136)  
at com.inductiveautomation.sfc.api.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:111)  
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)[/code]

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [September 23, 2016, 2:11pm UTC](https://forum.inductiveautomation.com/t/script-failing-due-to-trying-to-add-two-values/12159/2 "2016-09-23T14:11:22Z")

</div>

Either your tag path is invalid or the path is valid and the value is None.

You can debug your tag read with print statements so that you will know when you have the path correct and/or a good value to work with.

```auto
path = chart.tagPath+"ReleaseBank"
chart.releaseBank = system.tag.read(path).value

print "Path: %s" % path
print "Path exists: %s" % system.tag.exists(path)
print "Type: %s\tValue: %s" % (type(chart.releaseBank), chart.releaseBank)

```

---

<div class="post-metadata">

**Author:** ![jreynolds](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jreynolds](https://forum.inductiveautomation.com/u/jreynolds)\
**Post date:** [September 23, 2016, 3:51pm UTC](https://forum.inductiveautomation.com/t/script-failing-due-to-trying-to-add-two-values/12159/3 "2016-09-23T15:51:00Z")

</div>

Solved!  
The tag path wasn’t correct. Thanks!
