# Odd errors concerning large modules

**URL:** <https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [January 7, 2025, 2:52pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533 "2025-01-07T14:52:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Van\_Erp](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kyle\_Van\_Erp](https://forum.inductiveautomation.com/u/Kyle_Van_Erp)\
**Post date:** [January 7, 2025, 2:52pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/1 "2025-01-07T14:52:43Z")

</div>

Below is the error I receive when I try to access a list defined in a module called EpsonRC.Data

What's it's origin and how does one correct it?

Traceback (most recent call last):  
File "event:propertyChange", line 2, in   
java.lang.RuntimeException: Module or method too large in `<module:EpsonRC.Data>`.  
Please provide a CPython 2.7 bytecode file (.pyc), e.g. run  
python -m py\_compile module:EpsonRC.Data  
Alternatively, specify a CPython 2.7 command via the python.cpython2 property, e.g.:  
jython -Dpython.cpython2=python  
or (e.g. for pip) through the environment variable JYTHON\_OPTS:  
export JYTHON\_OPTS="-Dpython.cpython2=python"

java.lang.RuntimeException: java.lang.RuntimeException: Module or method too large in `<module:EpsonRC.Data>`.  
Please provide a CPython 2.7 bytecode file (.pyc), e.g. run  
python -m py\_compile module:EpsonRC.Data  
Alternatively, specify a CPython 2.7 command via the python.cpython2 property, e.g.:  
jython -Dpython.cpython2=python  
or (e.g. for pip) through the environment variable JYTHON\_OPTS:  
export JYTHON\_OPTS="-Dpython.cpython2=python"

```
caused by RuntimeException: Module or method too large in `module:EpsonRC.Data`.

```

Please provide a CPython 2.7 bytecode file (.pyc), e.g. run  
python -m py\_compile module:EpsonRC.Data

Alternatively, specify a CPython 2.7 command via the python.cpython2 property, e.g.:  
jython -Dpython.cpython2=python  
or (e.g. for pip) through the environment variable JYTHON\_OPTS:  
export JYTHON\_OPTS="-Dpython.cpython2=python"

Ignition v8.1.44 (b2024102210)  
Java: Azul Systems, Inc. 17.0.12

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 7, 2025, 2:55pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/2 "2025-01-07T14:55:30Z")

</div>

> [@Kyle\_Van\_Erp](#):
>
> Please provide a CPython 2.7 bytecode file

Ignition uses Jython, which doesn't support CPython modules.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 7, 2025, 3:09pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/3 "2025-01-07T15:09:38Z")

</div>

I'm not sure of all the CPython stuff is the issue or a distraction.

It seems the real problem might be this:

```python
 java.lang.RuntimeException: Module or method too large in <module:EpsonRC.Data>.

```

---

<div class="post-metadata">

**Author:** ![Kyle\_Van\_Erp](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kyle\_Van\_Erp](https://forum.inductiveautomation.com/u/Kyle_Van_Erp)\
**Post date:** [January 7, 2025, 3:18pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/4 "2025-01-07T15:18:06Z")

</div>

This is the root cause. So what are the limits of a module? And why are there limits at all?

The module EpsonRC.Data is a very large and follows the example

errorCodes = [[code, message, note1, note2], [code, message, note1, note2], [code, message, note1, note2], .......]

I'm assuming the work around would be to break my the module into separate smaller modules?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 7, 2025, 3:21pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/5 "2025-01-07T15:21:39Z")

</div>

Java itself has a limit of 65kb on method sizes, not sure what the Jython limits are, but it's probably related.

You'll have to break it up, yes.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 7, 2025, 3:24pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/6 "2025-01-07T15:24:43Z")

</div>

Ideally you refactor so that you aren't storing a large amount of data as code. Store it in a file, database, etc... and do a lookup. Or load it once at runtime into a dictionary, but don't write/store it as a mass of literal code.

---

<div class="post-metadata">

**Author:** ![Kyle\_Van\_Erp](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kyle\_Van\_Erp](https://forum.inductiveautomation.com/u/Kyle_Van_Erp)\
**Post date:** [January 7, 2025, 3:36pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/7 "2025-01-07T15:36:49Z")

</div>

I'm not the biggest fan of storing the data outside of Ignition. Standardizing projects with items not contained in a project can be tedious and hard to manage in the future (i.e. external text files or databases). Thank you for the suggestions!

---

<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:** [January 7, 2025, 6:03pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/8 "2025-01-07T18:03:39Z")

</div>

In some future version of Ignition we're planning to add an arbitrary 'file' resource type that you could use to address this kind of persistent data-attached-to-project use case.

In the meantime, you really should come up with a better approach than storing it in massive code files. The Jython interpreter is relatively slow, and you're doing the rest of your system no favors making it chew on these massive script file(s) every time the interpreter restarts (which is more or less every time you save any changes to your project).

I would put the data into a SQLite DB; if you use the special `${data}` placeholder we'll automatically use a localized path that will be included in a gateway backup, so you only have to manually ingest the data once:

> **[Connecting to SQLite | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/database-connections/connecting-to-databases/connecting-to-sqlite#relative-paths)**
>
> Connect Ignition to the PostreSQL Database

---

<div class="post-metadata">

**Author:** ![Kyle\_Van\_Erp](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kyle\_Van\_Erp](https://forum.inductiveautomation.com/u/Kyle_Van_Erp)\
**Post date:** [January 8, 2025, 10:06pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/9 "2025-01-08T22:06:16Z")

</div>

This was my first consideration but I'm working in Edge so it's not an option. I ended up shoving the data into a .txt file and wrote some code to access it.

For anyone interested that code is below.

```python
import ast
with open('C:/IgnitionData/codes.txt', 'r') as f:
	for line in f:
		# Evaluate the string to get an actual list
		row = ast.literal_eval(line.strip())
		if int(row[0]) == event.newValue:
			event.source.getComponent('Label').text = str(row[0])
			event.source.getComponent('Label 1').text = str(row[1])
			event.source.getComponent('Label 2').text = str(row[2])
			break

```

---

<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:** [January 8, 2025, 10:43pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/10 "2025-01-08T22:43:53Z")

</div>

Consider using a json file instead of a custom text file. Will allow you to include structured constants without any extra code.

---

<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:** [January 8, 2025, 11:00pm UTC](https://forum.inductiveautomation.com/t/odd-errors-concerning-large-modules/100533/11 "2025-01-08T23:00:17Z")

</div>

Or even just CSV. I'd take any known standard lingua franca format over `ast.literal_eval` 🙈
