When I had this problem, it was because one of the Python modules for my script failed to import.
The Splunk version of Python has its site-packages location in $SPLUNK_HOME/lib/python2.7/site-packages, but I'd installed my various modules into the regular Python. Try from a shell,
python -c 'import site; print(site.getsitepackages()[0])'
versus
$SPLUNK_HOME/bin/splunk cmd python -c 'import site; print(site.getsitepackages()[0])'
One solution is to use easy_install --install-dir /path/to/splunk/site-packages . to specifically install each module that failed.
To debug this sort of thing, it's helpful to edit $SPLUNK_HOME/etc/apps/search/bin/runshellscript.py, and replace the line 'p.communicate(input=stdin_data)' with two lines,
pipe = p.communicate(input=stdin_data)
logger.info("result: %s", pipe)
which will log any output (error messages, etc) from your script into the Splunk 'python.log' file.
... View more