Update the python script to catch all the errors