Ritesh Raj Sarraf wrote: > I'm using this for "option arguments" which are mutually inclusive. > But I want the user to pass atleast one "option argument" for the program > to function properly. > > For example, I have an option "--fetch-update" which requires a file "foo" > to check what it has to fetch. If the file is provided as an argument, it > uses it, else I add a parser.set_defaults("foo") which makes the program > to look for it in the current working directory. > > WHen the program see the "--fetch-update" option, it should execute the > required code. Now how do I check if at least one option has been passed > at the command-line ? > I have multiple options but I have parser.set_defaults() for each of them.
I'm sorry I don't understand your example. Wouldn't you need at least two options to demonstrate "mutually inclusive" options? The set_default() method seems to accept only keyword arguments -- but even it were used correctly I'm still unclear why you would need it at all. Perhaps you can post a few sample invocations (both correct and illegal) of your script together with a description (in English, not code) of how the script should react? Peter, puzzled -- http://mail.python.org/mailman/listinfo/python-list