Script is throwing error

I am getting the error

Cannot cast MyScript_372107627 to MyScript_372107627

during script execution, my script looks like below,

class MyScript
    # Import the interface required by the Script snap.
    include com.snaplogic.scripting.language.ScriptHook
    attr_reader :log, :input, :output, :error
    def initialize(log, input, output, error)
        @log = log
        @input = input
        @output = output
        @error = error
    end

    # The "execute()" method is called once when the pipeline is started
    # and allowed to process its inputs or just send data to its outputs.
    def execute()
        while input.hasNext() do
            begin
                # Read the next document, wrap it in a map and write out the wrapper
                doc = input.next()
                wrapper = {
                 "original" => doc
                }
                sleep 5
            
                log.info("Executed Ruby script")
                output.write(doc, wrapper)
            
            rescue => e
                log.error("Bad Rublet " + e.message)
                errWrapper = {
                    "errMsg" => e.message
                }
                error.write(errWrapper)
            end
        end
        
        
    end
end

# The Script Snap will look for a ScriptHook object in the "hook"
# variable.  The snap will then call the hook's "execute" method.
$hook = MyScript.new($log, $input, $output, $error)

This is the same script I got from Feature Request: Add delay, wait or sleep snap

Until last week the script was working as expected, however suddenly I am facing this issue.

I have been using python, so I am simply stating a possibility. Are you using a local snaplex? If so, if might be worth talking to your local snaplogic admin. Maybe they upgraded the snaplex, which would have happened after 2/18/2018, and missed something.

Here is our wait python script

1 Like

Thanks all.
Python works.

1 Like