diff options
author | Karel Kočí <cynerd@email.cz> | 2016-10-23 13:02:41 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-10-23 13:02:41 +0200 |
commit | 27f674958baff078563d02528c4b89e48854e35b (patch) | |
tree | 094d1769a9c49b5b71983c8bc3f74a2f346a0d9c /mcwrapper | |
parent | f556c681a5afae36a7d7c11ade5854a6de4a0896 (diff) | |
download | mcserver-wrapper-27f674958baff078563d02528c4b89e48854e35b.tar.gz mcserver-wrapper-27f674958baff078563d02528c4b89e48854e35b.tar.bz2 mcserver-wrapper-27f674958baff078563d02528c4b89e48854e35b.zip |
Handle missing mod file
Diffstat (limited to 'mcwrapper')
-rw-r--r-- | mcwrapper/mod.py | 9 |
1 files changed, 7 insertions, 2 deletions
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: |