From b859c113789b6a54db81b68f5e2df89f32b7878c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 12 Jun 2020 10:10:59 -0400 Subject: [PATCH] util: Convert to Python3 string encoding Signed-off-by: Kevin O'Connor --- klippy/util.py | 10 +++++----- 1 file 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: