I have a script which is meant to be used like this:
usage: installer.py dir [-h] [-v]

dir is a positional argument which is defined like this:

parser.add_argument('dir', default=os.getcwd())

I want the dir to be optional: when it’s not specified it should just be cwd.

Unfortunately when I don’t specify the dir argument, I get Error: Too few arguments.

4 s
4

Leave a Reply

Your email address will not be published. Required fields are marked *