# My love of Jython knows many bounds... (UnboundLocalError on ValueError!)

**URL:** <https://forum.inductiveautomation.com/t/my-love-of-jython-knows-many-bounds-unboundlocalerror-on-valueerror/104337>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [March 27, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/my-love-of-jython-knows-many-bounds-unboundlocalerror-on-valueerror/104337 "2025-03-27T21:13:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [March 27, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/my-love-of-jython-knows-many-bounds-unboundlocalerror-on-valueerror/104337/1 "2025-03-27T21:13:05Z")

</div>

Had this pop up when a script ran about 20 minutes ago:

```python
E [c.i.i.c.s.TimerScriptTask] [20:33:28.567]: Error executing global timer script: customer/ranger_device_clean @180,000ms . Repeat errors of this type will be logged as 'debug' messages. 
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last):
  File "<TimerScript:customer/ranger_device_clean @180,000ms >", line 1, in <module>
  File "<module:ranger_device_scan>", line 262, in clean_devices
  File "<module:shared.modbus>", line 19, in parse_modbus_map_csv
  File "<module:shared.ranger_csv_helpers>", line 15, in parse_csv
UnboundLocalError: local variable 'ValueError' referenced before assignment

```

Looking at line 15 in that bottom script, the failing line is:

```python
raise ValueError("Map CSV malformed")

```

I mean, I know about the issues that can happen with memory leaks and persistent objects right around Jython instance restarts, but ValueError should be built-in to Jython!

I can promise we are not intentionally creating our own ValueError class anywhere, and I just did a quick grep and didn't find any typos around ValueError being used. I feel like this is just the most corner-case bug in Jython I've bumped into.

And I suspect if I just touch the python files and nudge the project that it will go away and I will not see it again for months.

😱

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 27, 2025, 9:18pm UTC](https://forum.inductiveautomation.com/t/my-love-of-jython-knows-many-bounds-unboundlocalerror-on-valueerror/104337/2 "2025-03-27T21:18:16Z")

</div>

Might be this:

> [@\[IGN-6503\]Project Library Script Initialization Races](https://forum.inductiveautomation.com/t/ign-6503-project-library-script-initialization-races/98636):
>
> Are you annoyed by pseudo-random breakage in Ignition project library scripting? Odd top-level constants being garbled, or operations in the top level that have side effects running twice? Or more? Not happening much, but always around project edits, and sometimes even on gateway restart? Yeah, me too. frowning_face Poking around under the hood back in the spring, for a module development task, I ran across some problematic IA bytecode and pinged some people. But it went nowhere, as I co…
