Hello Cameron,

On Fri, Jan 27, 2023 at 4:45 PM Cameron Simpson <c...@cskk.id.au> wrote:
>
> On 27Jan2023 15:31, Ivan "Rambius" Ivanov <rambiusparkisan...@gmail.com> 
> wrote:
> >I am developing a script that accepts a time zone as an option. The
> >time zone can be any from pytz.all_timezones. I have
> >
> >def main():
> >    parser = argparse.ArgumentParser()
> >    parser.add_argument("-z", "--zone", choices=pytz.all_timezones)
> [...]
> >
> >It works, but when I run it with the -h option it dumps all entries in
> >pytz.all_timezones.
>
> What happens if you just presupply a `help=` parameter in
> `add_argument`?

I tried with def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-z", "--zone", choices=pytz.all_timezones,
help="a timezone from pytz.all_timezones")
    args = parser.parse_args()
    print(args)

-h still shows all the contents of pytz.all_timezones.

Regards
rambius

>
> Cheers,
> Cameron Simpson <c...@cskk.id.au>
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Tangra Mega Rock: http://www.radiotangra.com
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to