Python Setup and Usage, Release 3.9.5 • open() ,$_{io.open()}$ , and$_{codecs.open()}$ use the UTF-8 encoding by default. However, they still use the strict error handler by default so that attempting to open a binary file in text mode is likely to raise an exception rather than producing nonsense data. • os.fsdecode() and$_{os.fsencode()}$ use the UTF-8 encoding. Note that the standard stream settings in UTF-8 mode can be overridden by PYTHONIOENCODING (just as they can be in the default locale-aware mode). If set to 0 , the interpreter runs in its default locale-aware mode. Setting any other non-empty string causes an error during interpreter initialisation. If this environment variable is not set at all, then the interpreter defaults to using the current lo- cale settings, unless the current locale is identified as a legacy ASCII-based locale (as described for PYTHONCOERCECLOCALE ), and locale coercion is either disabled or fails. In such legacy locales, the in- terpreter will default to enabling UTF-8 mode unless explicitly instructed not to do so. Also available as the -X utf8 option. New in version 3.7: See PEP 540 for more details. Setting these variables only has an effect in a debug build of Python. If set, Python will print threading debug info. Need Python configured with the$_{--with-pydebug}$ build option. If set, Python will dump objects and reference counts still alive after shutting down the interpreter. Need Python configured with the$_{--with-trace-refs}$ build option. PYTHONDUMPREFS PYTHONTHREADDEBUG 1.2.1 Debug-mode variables 13 1.2. Environment variables