.. _non-ascii-file-name:

non-ascii-file-name / W2402
===========================

**Message emitted:**

``%s name "%s" contains a non-ASCII character.``

**Description:**

*Under python 3.5, PEP 3131 allows non-ascii identifiers, but not non-ascii file names.Since Python 3.5, even though Python supports UTF-8 files, some editors or tools don't.*

**Problematic code:**

``bàd.py``:

.. literalinclude:: /data/messages/n/non-ascii-file-name/bad/bàd.py
    :language: python


``not_bétter.py``:

.. literalinclude:: /data/messages/n/non-ascii-file-name/bad/not_bétter.py
    :language: python


**Correct code:**

``bad.py``:

.. literalinclude:: /data/messages/n/non-ascii-file-name/good/bad.py
    :language: python


``not_better.py``:

.. literalinclude:: /data/messages/n/non-ascii-file-name/good/not_better.py
    :language: python




**Related links:**

- `PEP 489 <https://peps.python.org/pep-0489/#export-hook-name>`_
- `PEP 672 <https://peps.python.org/pep-0672/#confusing-features>`_
- `Python issue 20485 <https://bugs.python.org/issue20485>`_


Created by the `nonascii-checker <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/non_ascii_names.py>`__ checker.