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

TypeError from extract_udevadm_info #90

Open
hello-binit opened this issue Jan 26, 2024 · 0 comments
Open

TypeError from extract_udevadm_info #90

hello-binit opened this issue Jan 26, 2024 · 0 comments
Assignees

Comments

@hello-binit
Copy link
Contributor

The stretch_factory.hello_device_utils.extract_udevadm_info() method throws a TypeError if it's unable to find the provided port. Minimal reproducible example:

import stretch_factory.hello_device_utils as hdu
hdu.extract_udevadm_info('/dev/gibberish')

The exception is:

TypeError                                 Traceback (most recent call last)
<ipython-input-5-891b81f5b8aa> in <module>
----> 1 hdu.extract_udevadm_info('/dev/gibberish')

~/.local/lib/python3.10/site-packages/stretch_factory/hello_device_utils.py in extract_udevadm_info(usb_port, ID_NAME)
    577     value = None
    578     dname = bytes(usb_port[5:], 'utf-8')
--> 579     out = exec_process([b'udevadm', b'info', b'-n', dname], True)
    580     if ID_NAME is None:
    581         value = out.decode(encoding='UTF-8')

~/.local/lib/python3.10/site-packages/stretch_factory/hello_device_utils.py in exec_process(cmdline, silent, input, **kwargs)
     80     if returncode != 0:
     81         raise RuntimeError('Got return value %d while executing "%s", stderr output was:\n%s' % (
---> 82         returncode, " ".join(cmdline), stderr.rstrip(b"\n")))
     83     return stdout
     84 

TypeError: sequence item 0: expected str instance, bytes found
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

No branches or pull requests

2 participants