# Limits of Python Script inside of Ignition

**URL:** <https://forum.inductiveautomation.com/t/limits-of-python-script-inside-of-ignition/12620>\
**Category:** General Discussion\
**Created:** [January 30, 2017, 8:27am UTC](https://forum.inductiveautomation.com/t/limits-of-python-script-inside-of-ignition/12620 "2017-01-30T08:27:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.minu](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.minu/32/3326_2.png) [@andrea.minu](https://forum.inductiveautomation.com/u/andrea.minu)\
**Post date:** [January 30, 2017, 8:27am UTC](https://forum.inductiveautomation.com/t/limits-of-python-script-inside-of-ignition/12620/1 "2017-01-30T08:27:45Z")

</div>

Hi  
Is there a Maximum number of rows ( or other limits to know) with python script?  
I created a script inside a button in the event of “actionperformed” ( 1055 rows) , everything worked correctly, but after a small modification, I cannot save anymore the script.

I have always the following Java error:  
anyone can give me a suggestion  
Thank you very much!

Andrea

[i]  
Parse error for event handler “actionPerformed”  
java.lang.NullPointerException

```
at org.python.objectweb.asm.MethodWriter.b(Unknown Source)

at org.python.objectweb.asm.MethodWriter.d(Unknown Source)

at org.python.objectweb.asm.MethodWriter.a(Unknown Source)

at org.python.objectweb.asm.ClassWriter.toByteArray(Unknown Source)

at org.python.compiler.ClassFile.write(ClassFile.java:124)

at org.python.compiler.Module.write(Module.java:613)

at org.python.compiler.Module.compile(Module.java:669)

at org.python.compiler.Module.compile(Module.java:648)

at org.python.compiler.LegacyCompiler$LazyLegacyBundle.ostream(LegacyCompiler.java:64)

at org.python.compiler.LegacyCompiler$LazyLegacyBundle.saveCode(LegacyCompiler.java:58)

at org.python.core.CompilerFacade.compile(CompilerFacade.java:33)

at org.python.core.Py.compile_flags(Py.java:1717)

at org.python.core.Py.compile_flags(Py.java:1722)

at org.python.core.Py.compile_flags(Py.java:1752)

at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor.applyChanges(ComponentScriptEditor.java:518)

at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor.access$600(ComponentScriptEditor.java:87)

at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor$5.actionPerformed(ComponentScriptEditor.java:342)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$500(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

```

java.lang.NullPointerException: java.lang.NullPointerExceptio[/i]

---

<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 30, 2017, 1:50pm UTC](https://forum.inductiveautomation.com/t/limits-of-python-script-inside-of-ignition/12620/2 "2017-01-30T13:50:26Z")

</div>

Hmmm. I’ve never run across such a limit, but your stacktrace suggests a limit on the bytes of the compiled code (not the number of lines). I don’t let event scripts get beyond a couple dozen lines, though, before I move the code to a project script. Project scripts are much easier to maintain, and the functions can be re-used more easily.

---

<div class="post-metadata">

**Author:** ![pdibenedetto](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pdibenedetto/32/6364_2.png) [@pdibenedetto](https://forum.inductiveautomation.com/u/pdibenedetto)\
**Post date:** [January 30, 2017, 8:14pm UTC](https://forum.inductiveautomation.com/t/limits-of-python-script-inside-of-ignition/12620/3 "2017-01-30T20:14:03Z")

</div>

I don’t know if this is your case, but I see this limitation, from one time that I try to import a third party python library (that it’s not jython compatible).

Apparently, it’s a jython issue, related to a JVM limitation. Any java compiled class must be lower than 64 Kb.

More info in: [bugs.jython.org/issue527524](http://bugs.jython.org/issue527524)

Regards,

---

<div class="post-metadata">

**Author:** ![andrea.minu](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.minu/32/3326_2.png) [@andrea.minu](https://forum.inductiveautomation.com/u/andrea.minu)\
**Post date:** [February 7, 2017, 1:41pm UTC](https://forum.inductiveautomation.com/t/limits-of-python-script-inside-of-ignition/12620/4 "2017-02-07T13:41:46Z")

</div>

Hi

Thank you very much for the your replies

Andrea
