util: Convert to Python3 string encoding

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-06-12 10:10:59 -04:00
parent 9ce07921c4
commit b859c11378
1 changed files with 5 additions and 5 deletions

View File

@ -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: