Option parser question - reading options from file as well as command line

Max Erickson maxerickson at gmail.com
Tue May 16 14:17:43 EDT 2006


Andrew Robert <andrew.arobert at gmail.com> wrote in
news:126k3273j7kb28f at corp.supernews.com: 

> Hi Everyone.
> 
> 
> I tried the following to get input into optionparser from either
> a file or command line.
> 
> 
> The code below detects the passed file argument and prints the
> file contents but the individual swithces do not get passed to
> option parser. 
> 
> Doing a test print of options.qmanager shows it unassigned.
> 
> Any ideas?
> 

Check parser.usage, it is likely to look a lot like your infile.

I'm not sure, but I think you need to pass your alternative arguments 
to parser.parse_args.

max




More information about the Python-list mailing list