cancel
Showing results for 
Search instead for 
Did you mean: 

Script is throwing error

krupalibshah
Contributor

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 - #5 by krupalibshah

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

1 ACCEPTED SOLUTION

Thanks all.
Python works.

View solution in original post

3 REPLIES 3

stephenknilans
Contributor

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.

aleung
Contributor III

Here is our wait python script

Thanks all.
Python works.