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