Python3 fixes#24
Merged
Merged
Conversation
By default Subprocess.open() opens file objects in binary mode, so the "filesystem" variable is an array of bytes, and comparing it to a string always yields false. Fix that by explicitly opening the stream in text mode.
By default open() reads in text which is not going to fly for a boot
sector.
Fatal: 'utf-8' codec can't decode byte 0x90 in position 6: invalid start byte
Exception:
Traceback (most recent call last):
File "/usr/sbin/grml2usb", line 1913, in main
install(iso, device)
File "/usr/sbin/grml2usb", line 1626, in install
install_grml(iso_mountpoint, device)
File "/usr/sbin/grml2usb", line 1653, in install_grml
check_boot_flag(device)
File "/usr/sbin/grml2usb", line 393, in check_boot_flag
data = image.read(520)
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 6: invalid start byte
Member
|
Very nice, thanks for the bug report as well the PR, very much appreciated! 👍 |
Member
|
Oh, turns out that |
Contributor
Author
|
Indeed, |
Member
|
ACK + thx. I've prepared the following commit which seems to work as needed, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small but crucial fixes which let grml2usb actually run sucessfuly under Python 3. See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=943838.