Python With Error Handling In Js