diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-10-01 19:30:48 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-10-04 14:36:08 -0400 |
commit | f1747b51182cbe4d77c991492b55fd2df12b4c18 (patch) | |
tree | 3da8d0349dbc0af81b25ce9c713cb3508cf75aff /klippy/configfile.py | |
parent | b8c91914b75c23bae05b29c9c0ebf2bff35a9b4a (diff) | |
download | kutter-f1747b51182cbe4d77c991492b55fd2df12b4c18.tar.gz kutter-f1747b51182cbe4d77c991492b55fd2df12b4c18.tar.xz kutter-f1747b51182cbe4d77c991492b55fd2df12b4c18.zip |
klippy: Add Python2 module wrappers and use Python3 module naming
Add wrappers for some common Python modules so that the code can run
on both Python2 and Python3.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/configfile.py')
-rw-r--r-- | klippy/configfile.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/klippy/configfile.py b/klippy/configfile.py index 0c4f8ba7..71f5ca60 100644 --- a/klippy/configfile.py +++ b/klippy/configfile.py @@ -3,7 +3,7 @@ # Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. -import os, glob, re, time, logging, ConfigParser as configparser, StringIO +import os, glob, re, time, logging, configparser, io error = configparser.Error @@ -211,7 +211,7 @@ class PrinterConfig: return data = '\n'.join(buffer) del buffer[:] - sbuffer = StringIO.StringIO(data) + sbuffer = io.StringIO(data) fileconfig.readfp(sbuffer, filename) def _resolve_include(self, source_filename, include_spec, fileconfig, visited): @@ -255,11 +255,11 @@ class PrinterConfig: self._parse_config_buffer(buffer, filename, fileconfig) visited.remove(path) def _build_config_wrapper(self, data, filename): - fileconfig = configparser.RawConfigParser() + fileconfig = configparser.RawConfigParser(strict=False) self._parse_config(data, filename, fileconfig, set()) return ConfigWrapper(self.printer, fileconfig, {}, 'printer') def _build_config_string(self, config): - sfile = StringIO.StringIO() + sfile = io.StringIO() config.fileconfig.write(sfile) return sfile.getvalue().strip() def read_config(self, filename): |