aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/configfile.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-10-08 00:23:31 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-10-08 00:23:31 -0400
commit5251bf23f1b59f9e75a58651bee3ac1989b910f4 (patch)
treec209f513c773f163843745f0d032b34fbbf35d25 /klippy/configfile.py
parent1a4d655a1860b8a6fddadcef7503f851d02e6388 (diff)
downloadkutter-5251bf23f1b59f9e75a58651bee3ac1989b910f4.tar.gz
kutter-5251bf23f1b59f9e75a58651bee3ac1989b910f4.tar.xz
kutter-5251bf23f1b59f9e75a58651bee3ac1989b910f4.zip
configfile: Workaround for non-ascii comments on Python2
Explicitly specify the comment_prefixes as regular Python2 strings - otherwise the configparser wont ignore non-ascii characters in comments. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/configfile.py')
-rw-r--r--klippy/configfile.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/klippy/configfile.py b/klippy/configfile.py
index 55aed295..518b574b 100644
--- a/klippy/configfile.py
+++ b/klippy/configfile.py
@@ -255,8 +255,9 @@ class PrinterConfig:
self._parse_config_buffer(buffer, filename, fileconfig)
visited.remove(path)
def _build_config_wrapper(self, data, filename):
+ cp = (';', '#')
fileconfig = configparser.RawConfigParser(
- strict=False, inline_comment_prefixes=(';','#'))
+ strict=False, comment_prefixes=cp, inline_comment_prefixes=cp)
self._parse_config(data, filename, fileconfig, set())
return ConfigWrapper(self.printer, fileconfig, {}, 'printer')
def _build_config_string(self, config):