Page 1 of 1

5.1.1 to 5.1.4 changed how include() works, what now?

Posted: 03 Aug 2024, 16:07
by rv23
My scripts have used include() since 4.x, and on 5.1.1 work fine, but on 5.1.4 I now get this error:

Console Output: Select all

General error during instruction selection: Illegal script class: lib.__script_40d3cf174f7523b1087cd0f6148bd68b

net.filebot.InvalidInputException: Illegal script class: lib.__script_40d3cf174f7523b1087cd0f6148bd68b
        at net.filebot.GroovyEngine$CompiledScriptClassLoader.processBytecode(Unknown Source)
        at groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:687)
        at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
        at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
        at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
        at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:938)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:373)
        at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:316)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
        at net.filebot.GroovyEngine$CompiledScriptClassLoader.parseClass(Unknown Source)
        at net.filebot.GroovyEngine.compile(Unknown Source)
        at net.filebot.GroovyEngine.eval(Unknown Source)
        at java.scripting/javax.script.AbstractScriptEngine.eval(Unknown Source)
        at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
        at net.filebot.cli.ScriptShell.runScript(Unknown Source)
        at net.filebot.cli.ScriptShellBaseClass.executeScript(Unknown Source)
        at net.filebot.cli.ScriptShellBaseClass.include(Unknown Source)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1333)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:165)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$3.invokeMethod(GroovyScriptEngineImpl.java:315)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at __script_fdf371a1979eefeba36325412c61578e.run(__script_fdf371a1979eefeba36325412c61578e:47)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:331)
        at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:72)
        at net.filebot.GroovyEngine.eval(Unknown Source)
        at java.scripting/javax.script.AbstractScriptEngine.eval(Unknown Source)
        at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
        at net.filebot.Main.main(Unknown Source)

1 error
And of course my script no longer works, what am I supposed to use/do instead of include()?
Note the files are not classes, just files that contain additional groovy methods that I share between multiple scripts (and to reduce the size of the main script and avoid the method too large error)

Re: 5.1.1 to 5.1.4 changed how include() works, what now?

Posted: 03 Aug 2024, 16:47
by rednoah
:?: Can you share your script code that not longer works? (a minimal reproducible test case also suffices if you're unwilling to share your code)


:idea: External Groovy runtime includes generally work. I'd need to see your code why your code specifically no longer works. Presumably, your code is not simple, so we might need to do a bit of trial & error testing to see what works and what doesn't and maybe find out why.

Re: 5.1.1 to 5.1.4 changed how include() works, what now?

Posted: 03 Aug 2024, 21:02
by rv23
I'm running Windows 11
Here is a simple script which I'm running in a pwsh session using

Console Output: Select all

filebot -script .\test_include_5_1_x.groovy
Here is the script

Groovy: Select all

include('lib/imdb')
Here is the imdb.groovy file (located in the lib subfolder)

Groovy: Select all

package lib

//--- VERSION 1.0.0
and the stacktrace again ..

Console Output: Select all

PS C:\Users\vitki\OneDrive\GitHub\runecalico\filebot\developing> filebot -script .\test_include_5_1_x.groovy
Initialize UserHome folder: C:\Users\vitki\OneDrive\GitHub\runecalico\filebot\FileBot_5.1.4-portable\data
Initialize Cache folder: C:\Users\vitki\OneDrive\GitHub\runecalico\filebot\FileBot_5.1.4-portable\data\cache
Initialize Logs folder: C:\Users\vitki\OneDrive\GitHub\runecalico\filebot\FileBot_5.1.4-portable\data\logs
Initialize new disk cache: C:\Users\vitki\OneDrive\GitHub\runecalico\filebot\FileBot_5.1.4-portable\data\cache\0
startup failed:
General error during instruction selection: Illegal script class: lib.__script_069474acd7d800b170d756e8096512e5

net.filebot.InvalidInputException: Illegal script class: lib.__script_069474acd7d800b170d756e8096512e5
        at net.filebot.GroovyEngine$CompiledScriptClassLoader.processBytecode(Unknown Source)
        at groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:687)
        at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
        at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
        at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
        at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:938)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:373)
        at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:316)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
        at net.filebot.GroovyEngine$CompiledScriptClassLoader.parseClass(Unknown Source)
        at net.filebot.GroovyEngine.compile(Unknown Source)
        at net.filebot.GroovyEngine.eval(Unknown Source)
        at java.scripting/javax.script.AbstractScriptEngine.eval(Unknown Source)
        at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
        at net.filebot.cli.ScriptShell.runScript(Unknown Source)
        at net.filebot.cli.ScriptShellBaseClass.executeScript(Unknown Source)
        at net.filebot.cli.ScriptShellBaseClass.include(Unknown Source)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1333)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:165)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$3.invokeMethod(GroovyScriptEngineImpl.java:315)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at __script_13d2d01d53fb186bfa51af98cac978ec.run(__script_13d2d01d53fb186bfa51af98cac978ec:1)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:331)
        at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:72)
        at net.filebot.GroovyEngine.eval(Unknown Source)
        at java.scripting/javax.script.AbstractScriptEngine.eval(Unknown Source)
        at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
        at net.filebot.Main.main(Unknown Source)

1 error

Done ?(?????)?

Re: 5.1.1 to 5.1.4 changed how include() works, what now?

Posted: 03 Aug 2024, 21:05
by rv23
I just tested it with 5.1.2, that's when this no longer works.

Re: 5.1.1 to 5.1.4 changed how include() works, what now?

Posted: 03 Aug 2024, 21:07
by rv23
ha ha .. Well that's both silly and a simple enough fix.
This no longer works

Groovy: Select all

include('lib/imdb')
This however does work

Groovy: Select all

include('lib/imdb.groovy')
Well .. okay, I can just spell out the full filename no problem..

Re: 5.1.1 to 5.1.4 changed how include() works, what now?

Posted: 03 Aug 2024, 21:33
by rednoah
rv23 wrote: 03 Aug 2024, 21:02

Groovy: Select all

package lib
I ran a test with that. package lib is indeed the problem. Have you tried removing the package lib declaration to see if that works?


:idea: The package declaration is not intended to work, nor is it intended to explicitly not work. You are probably the only person in the world that has ever used a package declaration in a FileBot custom format... so if it doesn't work, then it's officially unsupported as of now I suppose...



rv23 wrote: 03 Aug 2024, 21:07 This no longer works

Groovy: Select all

include('lib/imdb')
This however does work

Groovy: Select all

include('lib/imdb.groovy')
That makes no sense to me at all. I have absolutely no clue how that could possibly make a difference. But the world works in mysterious ways, and if you say it works, then maybe it works, by chance, for unknown reasons, perhaps sometimes but not always, certainly not by design in any case. :? :lol:





EDIT:

:!: I just realized you're talking about filebot -script calls and not custom formats. All of the above was written in the context of custom formats, so might be off. The root cause of packages / namespaces not / no longer being supported probably remains true for both format include() and script include() functions though.