From c1c7f903a79aecbd9894b24a7f7bef8c4c1f8708 Mon Sep 17 00:00:00 2001 From: leonfedden Date: Tue, 19 May 2020 10:29:17 +0100 Subject: [PATCH 1/2] write to same place each time --- pluribus/terminal/results.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pluribus/terminal/results.py b/pluribus/terminal/results.py index e30b4681..b7a4395f 100644 --- a/pluribus/terminal/results.py +++ b/pluribus/terminal/results.py @@ -11,9 +11,10 @@ class UserResults: """""" - def __init__(self, file_path: str = "results.yaml"): + def __init__(self): """""" - self._file_path = file_path + save_dir = os.path.expanduser("~/.poker") + self._file_path = os.path.join(save_dir, "results.yaml") try: with open(self._file_path, "r") as stream: self._results: Dict[str, Any] = yaml.safe_load(stream=stream) From 6b07a1e44869e4b37ccfbe9f092bb68db532f051 Mon Sep 17 00:00:00 2001 From: leonfedden Date: Tue, 19 May 2020 10:34:55 +0100 Subject: [PATCH 2/2] update the code to create a dir for results if it doesnt exist --- pluribus/terminal/results.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pluribus/terminal/results.py b/pluribus/terminal/results.py index b7a4395f..185f8f55 100644 --- a/pluribus/terminal/results.py +++ b/pluribus/terminal/results.py @@ -14,6 +14,7 @@ class UserResults: def __init__(self): """""" save_dir = os.path.expanduser("~/.poker") + os.makedirs(save_dir, exist_ok=True) self._file_path = os.path.join(save_dir, "results.yaml") try: with open(self._file_path, "r") as stream: