Top "Argparse" questions

A Python module for implementing command-line interfaces

TypeError: __init__() got an unexpected keyword argument 'type' in argparse

Hey so I'm using argparse to try and generate a quarterly report. This is what the code looks like: parser = …

python parsing argparse
Creating hidden arguments with Python argparse

Is it possible to add an Argument to an python argparse.ArgumentParser without it showing up in the usage or …

python argparse
Can't get argparse to read quoted string with dashes in it?

Is there a way to make argparse recognize anything between two quotes as a single argument? It seems to keep …

python argparse command-line-interface
How to make a short and long version of a required argument using Python Argparse?

I want to specify a required argument called inputdir but I also would like to have a shorthand version of …

python command-line-arguments argparse
Python Argparse: Raw string input

Apologies if this has been asked before, I did search for it but all hits seemed to be about python …

python string argparse rawstring
Getting the remaining arguments in argparse

I want to get all the remaining unused arguments at once. How do I do it? parser.add_argument('-i', …

python argparse
Optional stdin in Python with argparse

I found the very useful syntax parser.add_argument('-i', '--input-file', type=argparse.FileType('r'), default='-') for specifying an …

python stdin argparse
Setting options from environment variables when using argparse

I have a script which has certain options that can either be passed on the command line, or from environment …

python argparse
Argparse with required subparser

I'm using Python 3.4, I'm trying to use argparse with subparsers, and I want to have a similar behavior to the …

python python-3.x python-2.7 argparse
Python: How can I enable use of kwargs when calling from command line? (perhaps with argparse)

suppose I have the module myscript.py; This module is production code, and is called often as %dir%>python …

python python-2.7 command-line argparse keyword-argument