Re: Optparse to parsing Suggestions !!

2014-05-31 Thread Peter Otten
Am Sa Mai 31 2014, 13:08:12 schrieb Ganesh Pal: I think you have to do it manually: options, args = parser.parse_args() if options.object == super_block and options.path is not None: parser.error(Paths not allowed for 'super_block' object) elif options.object == files and

Re: Optparse to parsing Suggestions !!

2014-05-31 Thread Ian Kelly
On May 30, 2014 8:26 AM, Ganesh Pal ganesh1...@gmail.com wrote: Hello Python world , I wanted suggestion on how to modify the below code to help me accomodate the below two cases Your question was answered already, but I'd like to point out that optparse is deprecated. If possible, you

Re: Optparse to parsing Suggestions !!

2014-05-30 Thread Ganesh Pal
On Fri, May 30, 2014 at 7:48 PM, Ganesh Pal ganesh1...@gmail.com wrote: Hello Python world , I wanted suggestion on how to modify the below code to help me accomodate the below two cases # Here is the Sample code. def main(): ---MAIN--- parser =

Re: Optparse to parsing Suggestions !!

2014-05-30 Thread Peter Otten
Ganesh Pal wrote: Hello Python world , I wanted suggestion on how to modify the below code to help me accomodate the below two cases # Here is the Sample code. def main(): ---MAIN--- parser = optparse.OptionParser(usage='%prog [options] arg1.]', version='1.0')