If there is Nothing secret about the script, then can we see the script?
Or else try creating executables of the script in phases (i.e. by running first 20 LOC, then 40 LOC etc). Check, ,till which it point is running okay. Once you get error, check why you get error at that point only