From bce4a5cf26ebd091e7610aae5fdf6b8e7f5c90af Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Fri, 8 Feb 2019 20:13:06 +0100 Subject: [PATCH] Add files via upload --- terminis.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/terminis.py b/terminis.py index 43395d2..bb6f064 100644 --- a/terminis.py +++ b/terminis.py @@ -11,6 +11,7 @@ except ImportError: import random import sched import time +import os # You can change controls here. @@ -28,7 +29,7 @@ CONTROLS = { "QUIT": "q" } -FILE = ".terminis" +FILE = os.path.expanduser(os.path.join('~', ".terminis")) class Rotation: @@ -503,8 +504,11 @@ class Stats(Window): self.refresh() def save(self): - with open(FILE, mode='w') as f: - f.write(str(self.high_score)) + try: + with open(FILE, mode='w') as f: + f.write(str(self.high_score)) + except: + pass class Controls(Window): @@ -683,4 +687,3 @@ def main(): if __name__ == "__main__": main() - \ No newline at end of file