Skip to content

Commit

Permalink
updated uf2conv.py, fixing an issue on win32 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Huckies committed Nov 30, 2024
1 parent def0173 commit fa5fd16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/uf2conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def is_hex(buf):
w = buf[0:30].decode("utf-8")
except UnicodeDecodeError:
return False
if w[0] == ':' and re.match(b"^[:0-9a-fA-F\r\n]+$", buf):
if w[0] == ':' and re.match(rb"^[:0-9a-fA-F\r\n]+$", buf):
return True
return False

Expand Down Expand Up @@ -208,7 +208,7 @@ def get_drives():
"get", "DeviceID,", "VolumeName,",
"FileSystem,", "DriveType"])
for line in to_str(r).split('\n'):
words = re.split('\s+', line)
words = re.split(r'\s+', line)
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
drives.append(words[0])
else:
Expand Down Expand Up @@ -237,7 +237,7 @@ def has_info(d):
def board_id(path):
with open(path + INFO_FILE, mode='r') as file:
file_content = file.read()
return re.search("Board-ID: ([^\r\n]*)", file_content).group(1)
return re.search(r"Board-ID: ([^\r\n]*)", file_content).group(1)


def list_drives():
Expand Down Expand Up @@ -358,4 +358,4 @@ def error(msg):


if __name__ == "__main__":
main()
main()

0 comments on commit fa5fd16

Please sign in to comment.