Use try..catch when calling external python functions