Skip to content
Snippets Groups Projects
Unverified Commit 11f13920 authored by Chris Pepper's avatar Chris Pepper Committed by GitHub
Browse files

Fix Python3 (Windows) compatibility (#15597)

parent 725ec68f
Branches
Tags
No related merge requests found
...@@ -31,7 +31,7 @@ try: ...@@ -31,7 +31,7 @@ try:
# #
import subprocess import subprocess
# typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' # typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
driveStr = subprocess.check_output("fsutil fsinfo drives") driveStr = subprocess.check_output("fsutil fsinfo drives").decode('utf8')
# typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' # 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: ')
# typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\', # typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\',
...@@ -44,7 +44,7 @@ try: ...@@ -44,7 +44,7 @@ try:
for drive in drives: for drive in drives:
final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:' final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:'
try: try:
volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT) volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT).decode('utf8')
except Exception as e: except Exception as e:
continue continue
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment