1
0
Fork 0

Fix error when flashing with uf2conv.py

This commit is contained in:
Drashna Jael're 2024-08-07 09:07:33 -07:00
parent c686c5a2e1
commit 2f07f37391
Signed by: drashna
GPG key ID: DBA1FD3A860D1B11

View file

@ -246,10 +246,13 @@ def list_drives():
def write_file(name, buf):
with open(name, "wb") as f:
f.write(buf)
print("Wrote %d bytes to %s" % (len(buf), name))
try:
with open(name, "wb") as f:
f.write(buf)
print("Wrote %d bytes to %s" % (len(buf), name))
except IOError as e:
print(f"Failed to write to {name}: {e}")
print("Still may have wrote %d bytes to %s" % (len(buf), name))
def load_families():
# The expectation is that the `uf2families.json` file is in the same