Re: Custom help format for a choice argparse argument

2023-01-30 Thread Peter Otten
On 27/01/2023 21:31, Ivan "Rambius" Ivanov wrote: Hello, 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_timezon

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Thomas Passin
On 1/27/2023 4:53 PM, Ivan "Rambius" Ivanov wrote: Hello Cameron, On Fri, Jan 27, 2023 at 4:45 PM Cameron Simpson wrote: On 27Jan2023 15:31, Ivan "Rambius" Ivanov 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

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
Hello Cameron, On Fri, Jan 27, 2023 at 4:45 PM Cameron Simpson wrote: > > On 27Jan2023 15:31, Ivan "Rambius" Ivanov > 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

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Cameron Simpson
On 27Jan2023 15:31, Ivan "Rambius" Ivanov 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) [...]

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
> print(“Invalid timezone”,file=sys.stderr) > This is what I use now. I still wonder if I can mold HelpFormatter to do what I want it to do. > … > > > > > From: Python-list on > behalf of Ivan "Rambius" Ivanov > Date: Frida

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Weatherby,Gerard
van "Rambius" Ivanov Date: Friday, January 27, 2023 at 3:33 PM To: Python Subject: Custom help format for a choice argparse argument *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** Hello, I am developing a script that ac

Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
Hello, 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) args = parser.parse_args() print(args)