UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

Nobody nobody at nowhere.com
Tue Nov 24 07:15:18 CET 2009

On Mon, 23 Nov 2009 22:06:29 +0100, Alf P. Steinbach wrote:

> 10. It says UnicodeDecodeError on mail nr. something something.

That's what you get for using Python 3.x ;)

If you must use 3.x, don't use the standard descriptors. If you must use
the standard descriptors in 3.x, call detach() on them to get the
underlying binary stream, i.e.

	stdin = sys.stdin.detach()
	stdout = sys.stdout.detach()

and use those instead.

Or set LC_ALL or LC_CTYPE to an ISO-8859-* locale (any stream of bytes can
be decoded, and any string resulting from decoding can be encoded).

More information about the Python-list mailing list