Use subprocess.run()
encoding
argument instead of manual encode/decode
This commit is contained in:
parent
7919edce31
commit
7873b964bd
@ -12,7 +12,7 @@ import requests
|
||||
|
||||
|
||||
def sync_members(mailman_bin: Path, mailing_list: str, members: list[str]):
|
||||
members_data = "\n".join(members).encode('ascii')
|
||||
members_data = "\n".join(members)
|
||||
output = subprocess.run(
|
||||
[
|
||||
mailman_bin / "sync_members",
|
||||
@ -25,10 +25,11 @@ def sync_members(mailman_bin: Path, mailing_list: str, members: list[str]):
|
||||
mailing_list,
|
||||
],
|
||||
input=members_data,
|
||||
encoding="ascii",
|
||||
capture_output=True,
|
||||
check=True,
|
||||
)
|
||||
print(output.stdout.decode('ascii'))
|
||||
print(output.stdout)
|
||||
|
||||
|
||||
def main(mailman_bin: Path, api: str, token: str, list_suffix: str):
|
||||
@ -38,8 +39,11 @@ def main(mailman_bin: Path, api: str, token: str, list_suffix: str):
|
||||
return
|
||||
|
||||
existing_lists = subprocess.run(
|
||||
[mailman_bin / "list_lists", "-b"], capture_output=True, check=True
|
||||
).stdout.decode('ascii').split("\n")
|
||||
[mailman_bin / "list_lists", "-b"],
|
||||
encoding="ascii",
|
||||
capture_output=True,
|
||||
check=True,
|
||||
).stdout.split("\n")
|
||||
certification_lists = r.json()
|
||||
for name, members in certification_lists.items():
|
||||
list_name = name + list_suffix
|
||||
|
Loading…
Reference in New Issue
Block a user