diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-11-30 14:57:18 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-11-30 21:19:44 -0500 |
commit | ce7e7c40486561d832a03aa95fb003a0cdd3686d (patch) | |
tree | e5a058dce796da9d74cec45c5444c264623aee93 | |
parent | 524e0290bce93b2bf2565a631c6cf0812a728401 (diff) | |
download | kutter-ce7e7c40486561d832a03aa95fb003a0cdd3686d.tar.gz kutter-ce7e7c40486561d832a03aa95fb003a0cdd3686d.tar.xz kutter-ce7e7c40486561d832a03aa95fb003a0cdd3686d.zip |
klippy: Report an error if the config file does not exist
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/klippy.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py index 088d81bb..151bd1c6 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -82,7 +82,10 @@ class Printer: return eventtime + 1. def load_config(self): self.fileconfig = ConfigParser.RawConfigParser() - self.fileconfig.read(self.conffile) + res = self.fileconfig.read(self.conffile) + if not res: + raise ConfigParser.Error("Unable to open config file %s" % ( + self.conffile,)) self.mcu = mcu.MCU(self, ConfigWrapper(self, 'mcu')) if self.fileconfig.has_section('fan'): self.objects['fan'] = fan.PrinterFan( @@ -111,6 +114,10 @@ class Printer: self.build_config() self.gcode.set_printer_ready(True) self.state_message = "Running" + except ConfigParser.Error, e: + logging.exception("Config error") + self.state_message = "%s%s" % (str(e), message_restart) + self.reactor.update_timer(self.stats_timer, self.reactor.NEVER) except mcu.error, e: logging.exception("MCU error during connect") self.state_message = "%s%s" % (str(e), message_mcu_connect_error) |