From c7b65f50e3cd5a3adcab2fdd974ca876ae2cfbe1 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 6 Oct 2021 14:07:32 -0400 Subject: [PATCH] configfile: Ignore trailing comments starting with a semicolon Newer versions of configparser no longer default to ignoring trailing comments that start with a semicolon. Add that setting explicitly to avoid breaking existing config files. Signed-off-by: Kevin O'Connor --- klippy/configfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/klippy/configfile.py b/klippy/configfile.py index 71f5ca605..55aed295b 100644 --- a/klippy/configfile.py +++ b/klippy/configfile.py @@ -255,7 +255,8 @@ class PrinterConfig: self._parse_config_buffer(buffer, filename, fileconfig) visited.remove(path) def _build_config_wrapper(self, data, filename): - fileconfig = configparser.RawConfigParser(strict=False) + fileconfig = configparser.RawConfigParser( + strict=False, inline_comment_prefixes=(';','#')) self._parse_config(data, filename, fileconfig, set()) return ConfigWrapper(self.printer, fileconfig, {}, 'printer') def _build_config_string(self, config):