uf2
uf2 copied to clipboard
Change split strings to byte arrays for drive detection
Using python 3.7.2 on Windows 10 (version 1803, build 17134.472, and running in Bootcamp) I repeatedly got the following error:
Converting to uf2, output size: 50176, start address: 0x8000000
Traceback (most recent call last):
File "uf2conv.py", line 292, in <module>
main()
File "uf2conv.py", line 279, in main
drives = get_drives()
File "uf2conv.py", line 176, in get_drives
for line in r.split('\n'):
TypeError: a bytes-like object is required, not 'str'
As well as a similar error for the regular expressions split line immediately following. Changing the split strings to byte array objects solved the problem for me, as shown in this commit
The patch did not work for me. I am a Python novice, but found this solution that worked for me:
Change line 176 "for line in r.split('\n'):" to "for line in r.decode().split('\n'):"
The function call "decode()" changes the byte array to a string for further processing.
Hope that helps!