https://github.com/python/cpython/commit/69ecb4c234b6aa6f2863e8282526264a1f7942ba commit: 69ecb4c234b6aa6f2863e8282526264a1f7942ba branch: 3.14 author: Savannah Ostrowski <[email protected]> committer: savannahostrowski <[email protected]> date: 2025-12-09T17:22:26Z summary:
[3.14] GH-139946: Document argparse includes color codes when redirecting to stderr to file (#142398) Co-authored-by: Hugo van Kemenade <[email protected]> files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index b8ecbf3e584630..f64ace037f6975 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -644,6 +644,13 @@ variables and terminal capabilities. However, if ``color=False``, colored output is always disabled, even if environment variables like ``FORCE_COLOR`` are set. +.. note:: + + Error messages will include color codes when redirecting stderr to a + file. To avoid this, set the |NO_COLOR|_ or :envvar:`PYTHON_COLORS` + environment variable (for example, + ``NO_COLOR=1 python script.py 2> errors.txt``). + .. versionadded:: 3.14 _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
