Selaa lähdekoodia

Fix LPC176x build script for Python 3 (#15637)

Co-Authored-By: Sven Holzmann <powerprobot@users.noreply.github.com>
Bo Herrmannsen 5 vuotta sitten
vanhempi
commit
04a55c9188
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5
    3
      Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py

+ 5
- 3
Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py Näytä tiedosto

@@ -31,9 +31,11 @@ try:
31 31
         #
32 32
         import subprocess
33 33
         # typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
34
-        driveStr = subprocess.check_output("fsutil fsinfo drives").decode('utf8')
34
+        driveStr = str(subprocess.check_output("fsutil fsinfo drives"))
35 35
         # typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
36
-        driveStr = driveStr.strip().lstrip('Drives: ')
36
+        # driveStr = driveStr.strip().lstrip('Drives: ') <- Doesn't work in other Languages as English. In German is "Drives:" = "Laufwerke:"
37
+        FirstFound = driveStr.find(':',0,-1)         # Find the first ":" and
38
+        driveStr = driveStr[FirstFound + 1 : -1]     # truncate to the rest
37 39
         # typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\',
38 40
         # 'G:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\', 'L:\\', 'M:\\', 'Y:\\', 'Z:\\']
39 41
         drives = driveStr.split()
@@ -44,7 +46,7 @@ try:
44 46
         for drive in drives:
45 47
             final_drive_name = drive.strip().rstrip('\\')   # typical result (string): 'C:'
46 48
             try:
47
-                volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT).decode('utf8')
49
+                volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
48 50
             except Exception as e:
49 51
                 continue
50 52
             else:

Loading…
Peruuta
Tallenna