I didn't realize that the no-value arguments, -b, -h, etc are required? This seems to make things a bit more difficult considering unless I use the GNU style getopt all arguments are required to be passed?
I could be mistaken. I will have a look at what you have posted here and report my results. I appreciate the response. M On Tue, Feb 10, 2009 at 10:36 PM, John Machin <sjmac...@lexicon.net> wrote: > On Feb 11, 4:36 pm, Matthew Sacks <ntw...@gmail.com> wrote: >> The documentation leaves lack for want, especially the examples. > > You had two problems: > > (1) str(passedArgs): The docs make it plain that "args" is a list, not > a str instance: """args is the argument list to be parsed, without the > leading reference to the running program. Typically, this means > sys.argv[1:]""". The 1st and 2nd examples spell out the same story; > here's the 2nd: > """ > Using long option names is equally easy: > >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' > >>> args = s.split() > >>> args > ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', > 'a1', 'a2'] > """ > > (2) omitting the *required* options arg: (a) it's not wrapped in [] so > it's required (b) the docs say """To accept only long options, options > should be an empty string.""" > > IOW, it may "leave lack for want", but not in the areas causing you a > bother. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list