[issue22389] Generalize contextlib.redirect_stdout

John Isidore report at bugs.python.org
Mon Sep 29 12:40:04 CEST 2014


John Isidore added the comment:

There is stdout_redirected() function [1] that allows to redirect a file object given as `stdout` patameter including `sys.stderr`. It works at a file descriptor level i.e. it supports redirecting subprocess' output too but it doesn't work for StringIO (no fd).

[1] http://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python/22434262#22434262

----------
nosy: +John Isidore

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22389>
_______________________________________


More information about the Python-bugs-list mailing list