[FRPythoneers] dispatching from a script

Ian Kelly ian.g.kelly at gmail.com
Fri Apr 15 11:37:03 MDT 2011


On Fri, Apr 15, 2011 at 11:29 AM, Brent Pedersen <bpederse at gmail.com> wrote:
> hi, not sure if this list is the appropriate venue, but i'll ask anyway.

Nothing wrong with asking here, but comp.lang.python would probably be
better by virtue of having more users.


> so i have a python library and i want to have several scripts but keep
> them in the same name space.
> so i'll have "mymodule" that's importable from python and then i want
> to be able to have console scripts
> like:
>
> $ mymodule action_a --args files
> $ mymodule actoin_b --other_args other_files
> etc.

The argparse module in the standard library has support for
sub-commands and probably does exactly what you want.

Cheers,
Ian



More information about the FRPythoneers mailing list