← Back to team overview

sikuli-driver team mailing list archive

[Bug 1216780] [NEW] [1.0.1] Java error: Invalid method Code length ... in class file org/python/pycode/... (script too large)

 

Public bug reported:

***** problem is caused by a Java implementation limit:

A compiled class file cannot be larger than 64 KB.

Since internally when running a script, this is compiled into a class
file, and might be too large.

I will try to find some assistance help for a scripter, to know, when
his stuff is too large.

So you have to divide your script into smaller packages and use import

-----------------------------------------------------------------------------

I wrote a 500 line sikuli script to play baccarat on an online casino.
The script was working fine so I decided to add some conditional statements to handle specific events in the game.
I added an additional 2500 lines of code and when I run it I get the following error - what does it mean ?

[error] script [ casino.com] stopped with error at line --unknown--
[error] Could not evaluate error source nor reason. Analyze StackTrace!
[error] java.lang.ClassFormatError: Invalid method Code length 93997 in class file org/python/pycode/_pyx376
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119)
at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37)
at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:67)
at org.python.compiler.LegacyCompiler$LazyLegacyBundle.loadCode(LegacyCompiler.java:43)
at org.python.core.CompilerFacade.compile(CompilerFacade.java:34)
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:1732)
at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
at org.python.util.PythonInterpreter.ex

ecfile(PythonInterpreter.java:225)
at org.sikuli.script.SikuliScriptRunner.runPython(Unknown Source)
at org.sikuli.ide.SikuliIDE$ButtonRun.runPython(Unknown Source)
at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(Unknown Source)

java.lang.ClassFormatError: java.lang.ClassFormatError: Invalid method
Code length 93997 in class file org/python/pycode/_pyx376

** Affects: sikuli
     Importance: Medium
     Assignee: RaiMan (raimund-hocke)
         Status: In Progress

** Description changed:

+ ***** problem is caused by a Java implementation limit:
+ 
+ A compiled class file cannot be larger than 64 KB.
+ 
+ Since internally when running a script, this is compiled into a class
+ file, and might be too large.
+ 
+ I will try to find some assistance help for a scripter, to know, when
+ his stuff is too large.
+ 
+ So you have to divide your script into smaller packages and use import
+ 
+ -----------------------------------------------------------------------------
+ 
  I wrote a 500 line sikuli script to play baccarat on an online casino.
  The script was working fine so I decided to add some conditional statements to handle specific events in the game.
  I added an additional 2500 lines of code and when I run it I get the following error - what does it mean ?
  
  [error] script [ casino.com] stopped with error at line --unknown--
  [error] Could not evaluate error source nor reason. Analyze StackTrace!
- [error] java.lang.ClassFormatError: Invalid method Code length 93997 in class file org/python/pycode/_pyx376 
- at java.lang.ClassLoader.defineClass1(Native Method) 
- at java.lang.ClassLoader.defineClass(Unknown Source) 
- at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119) 
- at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37) 
- at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:67) 
- at org.python.compiler.LegacyCompiler$LazyLegacyBundle.loadCode(LegacyCompiler.java:43) 
- at org.python.core.CompilerFacade.compile(CompilerFacade.java:34) 
- 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:1732) 
- at org.python.core.__builtin__.execfile_flags(__builtin__.java:514) 
+ [error] java.lang.ClassFormatError: Invalid method Code length 93997 in class file org/python/pycode/_pyx376
+ at java.lang.ClassLoader.defineClass1(Native Method)
+ at java.lang.ClassLoader.defineClass(Unknown Source)
+ at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119)
+ at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37)
+ at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:67)
+ at org.python.compiler.LegacyCompiler$LazyLegacyBundle.loadCode(LegacyCompiler.java:43)
+ at org.python.core.CompilerFacade.compile(CompilerFacade.java:34)
+ 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:1732)
+ at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
  at org.python.util.PythonInterpreter.ex
  
- ecfile(PythonInterpreter.java:225) 
- at org.sikuli.script.SikuliScriptRunner.runPython(Unknown Source) 
- at org.sikuli.ide.SikuliIDE$ButtonRun.runPython(Unknown Source) 
- at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(Unknown Source) 
+ ecfile(PythonInterpreter.java:225)
+ at org.sikuli.script.SikuliScriptRunner.runPython(Unknown Source)
+ at org.sikuli.ide.SikuliIDE$ButtonRun.runPython(Unknown Source)
+ at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(Unknown Source)
  
  java.lang.ClassFormatError: java.lang.ClassFormatError: Invalid method
  Code length 93997 in class file org/python/pycode/_pyx376

** Changed in: sikuli
       Status: New => In Progress

** Changed in: sikuli
   Importance: Undecided => Medium

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => 1.1.0

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1216780

Title:
  [1.0.1] Java error: Invalid method Code length ... in class file
  org/python/pycode/... (script too large)

Status in Sikuli:
  In Progress

Bug description:
  ***** problem is caused by a Java implementation limit:

  A compiled class file cannot be larger than 64 KB.

  Since internally when running a script, this is compiled into a class
  file, and might be too large.

  I will try to find some assistance help for a scripter, to know, when
  his stuff is too large.

  So you have to divide your script into smaller packages and use import

  -----------------------------------------------------------------------------

  I wrote a 500 line sikuli script to play baccarat on an online casino.
  The script was working fine so I decided to add some conditional statements to handle specific events in the game.
  I added an additional 2500 lines of code and when I run it I get the following error - what does it mean ?

  [error] script [ casino.com] stopped with error at line --unknown--
  [error] Could not evaluate error source nor reason. Analyze StackTrace!
  [error] java.lang.ClassFormatError: Invalid method Code length 93997 in class file org/python/pycode/_pyx376
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119)
  at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37)
  at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:67)
  at org.python.compiler.LegacyCompiler$LazyLegacyBundle.loadCode(LegacyCompiler.java:43)
  at org.python.core.CompilerFacade.compile(CompilerFacade.java:34)
  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:1732)
  at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
  at org.python.util.PythonInterpreter.ex

  ecfile(PythonInterpreter.java:225)
  at org.sikuli.script.SikuliScriptRunner.runPython(Unknown Source)
  at org.sikuli.ide.SikuliIDE$ButtonRun.runPython(Unknown Source)
  at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(Unknown Source)

  java.lang.ClassFormatError: java.lang.ClassFormatError: Invalid method
  Code length 93997 in class file org/python/pycode/_pyx376

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1216780/+subscriptions


Follow ups

References