[Tutor] Question on option parser

Andrew Robert andrew.arobert at gmail.com
Tue May 16 18:31:46 CEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Everyone,

I have a program that I'd would like to enhance flexibility in calling.

Is there a way to leverage optionparser so it can accept input from both
command line and a configuration file?

Current code block is:

    #
    # Parse command line options and automatically build
    # help/usage display
    #
    parser = OptionParser()
    parser.add_option("-m","--qmanager", dest="qmanager",
                help="\t\tQueue Manager to inquire against"),
    parser.add_option("-q","--queue", dest="queue",
                help="\t\tQueue the message will be sent to"),
    parser.add_option("-t","--to", dest="mto",
                help="\t\taddress any mail messages will be sent to")
    (options, args) = parser.parse_args()

Any help you can provide on this would be greatly appreciated.

Thanks,
Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)

iD8DBQFEaf5xDvn/4H0LjDwRAnzAAJ94RcBxTxARkvX5pwMtvVM9n/vntgCfZ1bV
FvMSiQpo/2EneM9hvuxpCi8=
=2Il4
-----END PGP SIGNATURE-----


More information about the Tutor mailing list