Changed all python scripts to only run in __main__ and to catch
exceptions and return an exit status of 1 if anything goes wrong