This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients aronacher, benjamin.peterson, flox, hynek, martin.panter, pitrou, python-dev, r.david.murray, stutzbach
Date 2014-05-15.21:50:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1400190654.2316.27.camel@fsol>
In-reply-to <1400190011.03.0.49957828122.issue21364@psf.upfronthosting.co.za>
Content
> The same situations people wrapped streams before on python 2:
> 
> * code.py users.  Werkzeug's traceback system implements a remote python 
>   shell through it.
> * any system that wants to unittest shell scripts on a high level.
> * any system that wants to execute arbitrary python code and then
>   capture whatever output it did.  This is for instance what I see
>   Sphinx users frequently do (or doctests)

I see, I misunderstood you. You actually want to get back the bytes
output of e.g. stdout, right?
You could indeed use a TextIOWrapper wrapping a BytesIO object. Or of
course another possibility is to do the encoding yourself, e.g.
sys.stdout.getvalue().encode('utf-8', 'surrogateescape').
History
Date User Action Args
2014-05-15 21:50:57pitrousetrecipients: + pitrou, benjamin.peterson, stutzbach, aronacher, r.david.murray, flox, python-dev, hynek, martin.panter
2014-05-15 21:50:57pitroulinkissue21364 messages
2014-05-15 21:50:57pitroucreate