Add try except in python script