From 04a55c91884389c678bfc421b021621ca978f1b1 Mon Sep 17 00:00:00 2001 From: Bo Herrmannsen Date: Thu, 24 Oct 2019 19:16:02 +0200 Subject: [PATCH] Fix LPC176x build script for Python 3 (#15637) Co-Authored-By: Sven Holzmann --- Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py b/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py index 7f2a023630..b3ab59026e 100644 --- a/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py +++ b/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py @@ -31,9 +31,11 @@ try: # import subprocess # typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' - driveStr = subprocess.check_output("fsutil fsinfo drives").decode('utf8') + driveStr = str(subprocess.check_output("fsutil fsinfo drives")) # typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' - driveStr = driveStr.strip().lstrip('Drives: ') + # driveStr = driveStr.strip().lstrip('Drives: ') <- Doesn't work in other Languages as English. In German is "Drives:" = "Laufwerke:" + FirstFound = driveStr.find(':',0,-1) # Find the first ":" and + driveStr = driveStr[FirstFound + 1 : -1] # truncate to the rest # typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\', # 'G:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\', 'L:\\', 'M:\\', 'Y:\\', 'Z:\\'] drives = driveStr.split() @@ -44,7 +46,7 @@ try: for drive in drives: final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:' try: - volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT).decode('utf8') + volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT)) except Exception as e: continue else: