[Python-ideas] Adding an 'errors' argument to print

Paul Moore p.f.moore at gmail.com
Fri Mar 24 14:29:48 EDT 2017


On 24 March 2017 at 16:37, Victor Stinner <victor.stinner at gmail.com> wrote:
> *If* we change something, I would prefer to modify sys.stdout. The
> following issue proposes to add
> sys.stdout.set_encoding(errors='replace'):
> http://bugs.python.org/issue15216

I thought I recalled seeing something like that discussed somewhere. I
agree that this is a better approach (even though it's not as granular
as being able to specify on an individual print statement).

> You can already set the PYTHONIOENCODING environment variable to
> ":replace" to use "replace" on sys.stdout (and sys.stderr).

That's something I didn't know. Thanks for the pointer!

Paul


More information about the Python-ideas mailing list