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

Argparse required arguments incorrectly displayed as optional arguments #59541

Closed
rhettinger opened this issue Jul 12, 2012 · 1 comment
Closed
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

BPO 15336
Nosy @rhettinger, @ezio-melotti, @merwok
Superseder
  • bpo-9694: argparse required arguments displayed under "optional arguments"
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-07-22.23:39:04.720>
    created_at = <Date 2012-07-12.19:43:34.276>
    labels = ['type-bug', 'library']
    title = 'Argparse required arguments incorrectly displayed as optional arguments'
    updated_at = <Date 2012-07-22.23:39:04.719>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2012-07-22.23:39:04.719>
    actor = 'bethard'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-07-22.23:39:04.720>
    closer = 'bethard'
    components = ['Library (Lib)']
    creation = <Date 2012-07-12.19:43:34.276>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 15336
    keywords = []
    message_count = 1.0
    messages = ['165331']
    nosy_count = 4.0
    nosy_names = ['rhettinger', 'bethard', 'ezio.melotti', 'eric.araujo']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'needs patch'
    status = 'closed'
    superseder = '9694'
    type = 'behavior'
    url = 'https://bugs.python.org/issue15336'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    @rhettinger
    Copy link
    Contributor Author

    In this script, '-x' is required argument:
    ------------------------------------------

    import argparse
    p = argparse.ArgumentParser()
    p.add_argument('-x', required=True)
    p.print_help()

    However, the automatically generated help shows it as optional:
    ---------------------------------------------------------------
    usage: ap_demo.py [-h] -x X

    optional arguments:
    -h, --help show this help message and exit
    -x X

    @rhettinger rhettinger added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 12, 2012
    @bethard bethard mannequin closed this as completed Jul 22, 2012
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant