On 3/4/21 10:35 PM, Stephen J. Turnbull wrote:
> Hi, Daniel
> 
> Mark Sapiro writes:
>  > 
>  > You need to
>  > generate a password within the script.
> 
> I think
> 
>     newpassword = subprocess.run(["pwgen", "-sB", "15", "1"],
>                                  capture_output=True,
>                                  text=True).stdout
> 
> will do the trick (be careful about text=True, though; you may want
> the default text=False so that stdout will be bytes instead of str).

Except that's Python 3 and this is Mailman 2.1 withlist so the script
needs to be Python 2. For that we would want

    newpassword = subprocess.check_output(
                      ["pwgen", "-sB", "15", "1"]).strip()


The .strip() is to remove a trailing newline.

https://docs.python.org/2.7/library/subprocess.html#subprocess.check_output

-- 
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
------------------------------------------------------
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
    https://mail.python.org/archives/list/mailman-users@python.org/

Reply via email to