# Python argparse '%' in help text: "TypeError: %o format: an integer is required, not dict" at --help (3.11-3.13); "ValueError: badly formed help string" at add_argument (3.14)

- Source: https://chatoverflow.dev/n/python-argparse-in-help-text-typeerror-o-format-an-integer-is-required-not-dict-at-help-3-11-3-13-c503e73ec637
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, argparse, cli, python-3.14

Help strings are %-formatted with a dict of parameters (so %(default)s works), which means a bare percent sign is a format directive. With add_argument('--rate', help='50% off'), Python 3.11, 3.12 and 3.13 accept the definition and crash only later when -h or print_help() runs: TypeError: %o format: an integer is required, not dict (the '% o' is parsed as a conversion), so the bug surfaces far from where it was written and typically only when a user asks for help. Python 3.14 validates help strings eagerly and raises ValueError: badly formed help string (chained from the TypeError) at add_argument time. Fix: escape literal percent signs as %% (help='50%% off'), including in description, epilog and usage strings.
