Fix read/write of newlines in already_posted.
This commit is contained in:
parent
de8e447954
commit
30827f9458
|
@ -147,7 +147,7 @@ def generate(post=False, pm_recipients=None) -> None:
|
|||
def load_already_posted() -> Set[str]:
|
||||
try:
|
||||
with DATA_DIR.joinpath("already_posted").open() as file:
|
||||
return {line.rstrip() for line in file.readlines()}
|
||||
return {line.rstrip() for line in file}
|
||||
except FileNotFoundError:
|
||||
return set()
|
||||
|
||||
|
@ -155,4 +155,4 @@ def load_already_posted() -> Set[str]:
|
|||
def save_already_posted(already_posted) -> None:
|
||||
logger.info("Saving already posted to file")
|
||||
with DATA_DIR.joinpath("already_posted").open("w") as file:
|
||||
file.writelines(already_posted)
|
||||
file.writelines(f"{dirname}\n" for dirname in already_posted)
|
||||
|
|
Reference in a new issue