Could you use python's built-in support for redirection rather than adding bash redirections?