Ritesh Raj Sarraf wrote:
> ./sarraf.py --fetch-update /bar
>
> If the user gives the /bar argument, the program should save the
> downloaded files to /bar. But I'm assuming that the user could be dumb or
> too lazy, in which case --fetch-udpate should use the parser.set_defaults
> value i.e. /foo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Peter,
Peter Otten on Wednesday December 7 2005 21:25 wrote:
> This can be simplified to
>
> parser.add_option("-d", "--download-dir", default="foo",
> help="Root directory path to save the downloaded files")
>
> which seems to be the reaso
Ritesh Raj Sarraf wrote:
> parser.add_option("-d","--download-dir", dest="download_dir",
> help="Root directory path to save the downloaded files",
> action="store", type="string")
> parser.set_defaults(download_dir="foo")
This can be simplified to
parser.add_
On Tue, 6 Dec 2005, Peter Otten wrote:
> 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" whic
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
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Peter Otten on Monday December 5 2005 03:34 wrote:
> options, args = parser.parse_args(values=MyValues())
>
> but you should do your users a favour and give them meaningful error
> messages. I can't conceive how you could achieve this by checking the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Marc 'BlackJack' Rintsch on Monday December 5 2005 03:24 wrote:
> In <[EMAIL PROTECTED]>, Ritesh Raj
> Sarraf wrote:
>
>> My program uses mostly "option arguments" hence my len(args) value is
>> always zero. I need to check if the user has passed the
I don't think that's actually what you want to do. Yes arguments are
not to be used directly as option arguments (otherwise why have option
arguments anyways ;-) but each option argument is usually evaluated
under the evaluation of the actual option and optparse will error on
invalid use of the opt
Ritesh Raj Sarraf wrote:
> My program uses mostly "option arguments" hence my len(args) value is
> always zero. I need to check if the user has passed the correct number of
> "option arguments". Something like:
>
> (options,args) = parser.parse_args()
>
> len(options) != 1 or len(options) > 2:
>
In <[EMAIL PROTECTED]>, Ritesh Raj
Sarraf wrote:
> My program uses mostly "option arguments" hence my len(args) value is always
> zero. I need to check if the user has passed the correct number of "option
> arguments". Something like:
>
> (options,args) = parser.parse_args()
>
> len(options) !=
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I'm using optparse module to parse all options and arguments.
My program uses mostly "option arguments" hence my len(args) value is always
zero. I need to check if the user has passed the correct number of "option
arguments". Something like:
(op
11 matches
Mail list logo