On Oct 22, 12:20 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Mon, 22 Oct 2007 02:41:17 +0000, JKPeck wrote:
> > We want to wrap the stdout device in a codec in order to decode output
> > transparently according to a particular code page (which might not be
> > the system code page). However, codec.open requires a filename, and
> > stdout may be a tty or otherwise anonymous. How can we accomplish
> > this wrapping?
>
> The `codecs` module has more than just the `codecs.open()` function. Try
> something like this::
>
> sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
>
> Ciao,
> Marc 'BlackJack' Rintsch
Thanks, codecs.getwriter is just the ticket. Our app may not be
running in the system encoding, so the file system encoding is not
appropriate.
--
http://mail.python.org/mailman/listinfo/python-list