From 27f674958baff078563d02528c4b89e48854e35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 23 Oct 2016 13:02:41 +0200 Subject: Handle missing mod file --- mcwrapper/mod.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mcwrapper/mod.py') diff --git a/mcwrapper/mod.py b/mcwrapper/mod.py index 78ffb8e..3d3967c 100644 --- a/mcwrapper/mod.py +++ b/mcwrapper/mod.py @@ -2,6 +2,7 @@ import random from . import alarm +from . import prints class MoD: @@ -14,8 +15,12 @@ class MoD: def load_mods(self): "Loads messages from self.file" - with open(self.file, "r") as f: - self.lines = f.readlines() + try: + with open(self.file, "r") as f: + self.lines = f.readlines() + except OSError as e: + prints.warning("Loading of MoD file failed: " + str(e)) + self.lines = [] def __handler__(self): if len(self.lines) > 0: -- cgit v1.2.3