Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

% in documentation breaks Argumentparser #124260

Closed
BIRDSLab opened this issue Sep 20, 2024 · 2 comments
Closed

% in documentation breaks Argumentparser #124260

BIRDSLab opened this issue Sep 20, 2024 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@BIRDSLab
Copy link

BIRDSLab commented Sep 20, 2024

Bug report

Bug description:

from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument(
    "-v", dest="verbose", 
    help="duck around %", 
    action='store_true' 
)    
# Find out
options = parser.parse_args()

Run this with a '-h' on the commandline, and watch the pretty backtrace

CPython versions tested on:

3.10

Operating systems tested on:

Linux

@BIRDSLab BIRDSLab added the type-bug An unexpected behavior, bug, or error label Sep 20, 2024
@ZeroIntensity
Copy link
Member

This is intended, % is used for format strings. To escape it, use %% (see the docs):

parser.add_argument(
    "-v", dest="verbose", 
    help="duck around %%",
    action='store_true' 
)    

@ZeroIntensity ZeroIntensity added the pending The issue will be closed if no feedback is provided label Sep 20, 2024
@zware zware closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2024
@zware zware removed the pending The issue will be closed if no feedback is provided label Sep 20, 2024
@terryjreedy
Copy link
Member

Please ask about puzzling behavior on https://discuss.python.org/c/help/7, where answers are more visible to others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants