Fix read/write of newlines in already_posted.
This commit is contained in:
parent
de8e447954
commit
30827f9458
1 changed files with 2 additions and 2 deletions
|
@ -147,7 +147,7 @@ def generate(post=False, pm_recipients=None) -> None:
|
||||||
def load_already_posted() -> Set[str]:
|
def load_already_posted() -> Set[str]:
|
||||||
try:
|
try:
|
||||||
with DATA_DIR.joinpath("already_posted").open() as file:
|
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:
|
except FileNotFoundError:
|
||||||
return set()
|
return set()
|
||||||
|
|
||||||
|
@ -155,4 +155,4 @@ def load_already_posted() -> Set[str]:
|
||||||
def save_already_posted(already_posted) -> None:
|
def save_already_posted(already_posted) -> None:
|
||||||
logger.info("Saving already posted to file")
|
logger.info("Saving already posted to file")
|
||||||
with DATA_DIR.joinpath("already_posted").open("w") as 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