getopt: Make argument mandatory

Fredrik Lundh fredrik at pythonware.com
Wed Dec 15 09:09:27 EST 2004


Frans Englich wrote:

> In my use of getopt.getopt, I would like to make a certain parameter
> mandatory.

but you just did:

>        if configurationFile == "":
>            print "You must pass an URL/path to a configuration file, see
> --help."
>            sys.exit(common.exitCodes["parameter"])

> Is it possible?

afaik, getopt doesn't have any built-in validation features; Python's got
more than enough of them already...

</F> 






More information about the Python-list mailing list