diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-06-12 10:10:59 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-10-01 19:22:13 -0400 |
commit | b859c113789b6a54db81b68f5e2df89f32b7878c (patch) | |
tree | 8117bc62a75df8e6b33b442c6c4f8a72237fffab | |
parent | 9ce07921c4690f3fab2a6ad9beaab4848f4732b9 (diff) | |
download | kutter-b859c113789b6a54db81b68f5e2df89f32b7878c.tar.gz kutter-b859c113789b6a54db81b68f5e2df89f32b7878c.tar.xz kutter-b859c113789b6a54db81b68f5e2df89f32b7878c.zip |
util: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/util.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/klippy/util.py b/klippy/util.py index 14009855..0321014e 100644 --- a/klippy/util.py +++ b/klippy/util.py @@ -67,7 +67,7 @@ def dump_mcu_build(): # Try to log last mcu config dump_file_stats(build_dir, '.config') try: - f = open(os.path.join(build_dir, '.config'), 'rb') + f = open(os.path.join(build_dir, '.config'), 'r') data = f.read(32*1024) f.close() logging.info("========= Last MCU build config =========\n%s" @@ -77,7 +77,7 @@ def dump_mcu_build(): # Try to log last mcu build version dump_file_stats(build_dir, 'out/klipper.dict') try: - f = open(os.path.join(build_dir, 'out/klipper.dict'), 'rb') + f = open(os.path.join(build_dir, 'out/klipper.dict'), 'r') data = f.read(32*1024) f.close() data = json.loads(data) @@ -96,7 +96,7 @@ def dump_mcu_build(): def get_cpu_info(): try: - f = open('/proc/cpuinfo', 'rb') + f = open('/proc/cpuinfo', 'r') data = f.read() f.close() except (IOError, OSError) as e: @@ -130,10 +130,10 @@ def get_git_version(from_file=True): ver, err = process.communicate() retcode = process.wait() if retcode == 0: - return ver.strip() + return ver.strip().decode() else: logging.debug("Error getting git version: %s", err) - except OSError: + except: logging.debug("Exception on run: %s", traceback.format_exc()) if from_file: |