Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-UTF-8 device models #108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jstasiak
Copy link

@jstasiak jstasiak commented Sep 23, 2024

Took me a while to figure out why Fedora 40 installer was dying on me on a Wyse 3040 thin client and I finally narrowed it down to pyparted and found the associated issue (linked).

The fix proposed in the issue comments worked for me so I figured I'd send a PR.

Before:

>>> import parted
>>> parted.getDevice('/dev/mmcblk0').model
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/pyparted/build/lib.linux-x86_64-cpython-312/parted/device.py", line 69, in model
    return self.__device.model
           ^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 9: invalid start byte

After:

>>> import parted
>>> parted.getDevice('/dev/mmcblk0').model
'MMC H8G4a�'

Resolves: #76

Took me a while to figure out why Fedora 40 installer was dying on me
on a Wyse 3040 thin client and I finally narrowed it down to pyparted
and found the associated issue (linked).

The fix proposed in the issue comments worked for me so I figured I'd
send a PR.

Before:

    >>> import parted
    >>> parted.getDevice('/dev/mmcblk0').model
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/root/pyparted/build/lib.linux-x86_64-cpython-312/parted/device.py", line 69, in model
        return self.__device.model
               ^^^^^^^^^^^^^^^^^^^
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 9: invalid start byte

After:

    >>> import parted
    >>> parted.getDevice('/dev/mmcblk0').model
    'MMC H8G4a�'

Resolves: dcantrell#76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception when returning non-UTF-8 model names
1 participant