From e35a64734f146366a99b2bec4cc3999b321825bb Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Sun, 29 Sep 2019 19:44:31 +0200 Subject: [PATCH] Add filesize check --- sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ai/train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ai/train.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ai/train.py index f081681..97e9a6d 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ai/train.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ai/train.py @@ -54,7 +54,7 @@ class Stats(object): def load(self): with self._lock: - if os.path.exists(self.path): + if os.path.exists(self.path) and os.path.getsize(self.path) > 0: core.log("[ai] loading %s" % self.path) with open(self.path, 'rt') as fp: obj = json.load(fp)