I would still move this except line up right under the appropriate code. It will never happen for subprocess. You can early exit via sys.exit(failurecode).