[Python-Dev] PEP 538 warning at startup: please remove it

INADA Naoki songofacandy at gmail.com
Mon Jun 12 05:35:11 EDT 2017


On Mon, Jun 12, 2017 at 5:56 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> Hi,
>
> Nick Coghlan pushed his implementation of his PEP 538: nice! Nice step
> forward to UTF-8 everywhere ;-)
>
> I would prefer to not be annoyed by warning messages about encodings
> at startup if possible:
>
> "Python detected LC_CTYPE=C: LC_CTYPE coerced to C.UTF-8 (set another
> locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion
> behavior)."
>

This is intentional behavior, to motivate people to use UTF-8 locale without
coercion.

> Note: I don't consider that 2>/dev/null is a good practice to ignore a
> single warning, since it will ignore *all* message written into
> stderr, including useful warnings like ResourceWarning or "Exception
> ignored ...".

I think "Good practice" is set `LC_CTYPE=C.UTF-8` environment variable,
as warning says.

# When PEP 540 is accepted, it can be used to disable the warning too.

Regards,


More information about the Python-Dev mailing list