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 <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
------------------------------------------------------
Mailman-Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
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/[email protected]/
https://mail.python.org/archives/list/[email protected]/