Skip to content

Commit c4fb950

Browse files
Document workaround for argparse stderr to file
1 parent 94012d6 commit c4fb950

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/library/argparse.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,12 @@ variables and terminal capabilities. However, if ``color=False``, colored
644644
output is always disabled, even if environment variables like ``FORCE_COLOR``
645645
are set.
646646

647+
.. note::
648+
649+
Error messages will include color codes when redirecting stderr to a
650+
file. To avoid this, set the :envvar:`NO_COLOR` or :envvar:`PYTHON_COLORS`
651+
environment variable (e.g., ``NO_COLOR=1 python script.py 2> errors.txt``).
652+
647653
.. versionadded:: 3.14
648654

649655

0 commit comments

Comments
 (0)