Update kernel_utils.py

Added a try except for weave code