-
Notifications
You must be signed in to change notification settings - Fork 76
Avoid SPIDevice init failure in absence of libgpiod bindings #102
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
base: main
Are you sure you want to change the base?
Conversation
It sounds like this happened while using Blinka, but Blinka should have definitions for |
In am on a A64-OLinuXino by Olimex. From what I can trace back, I installed Blinka using I have no idea if it should be a dependency (maybe it is not a dependency so that you can use libgpiod-dev from the system. Or because micropython stuff does not need it?), but if you add it as a dependency you should remove also these warnings:
It is defined there indeed, but it fails when importing in absence of gpiod. The traceback is more or less the following: So, I think that either we do as proposed in this pull request or we take |
I'm not familiar with A64-OLinuXino device, but it sounds to me perhaps it has different requirements for using GPIO pins compared to RPi. I don't think it's an issue with Blinka, but I've really only messed with RPi hardware, not ventured out to the others. If the rest of the code works on that device and only the import for typing is preventing it from working, then I think it's fine to have this workaround to avoid the import / typing error. |
Sorry, maybe I gave the impression that this was an A64-OLinuXino specific issue. It is not. The issue was a very minor one and does not deserve more discussion, IMHO. |
The issue I'm concerned about is that using this library should inherently require the use of Adafruit Blinka, which needs to (and already should) provide the necessary definition for |
And if it is supported (perhaps by the A64 definition), then the question is should Blinka raise an issue if |
You are right, it does.
Exactly, the issue is not board-specific.
It is defined, but it fails when importing if gpiod is missing. Then this try-except block catches the ImportError: Adafruit_CircuitPython_BusDevice/adafruit_bus_device/spi_device.py Lines 14 to 22 in 519bf36
It does: So, either:
|
When importing other Adafruit components, I observed this error:
This is happening because I did not have the "libgpiod Python bindings" (installable with
pip install gpiod
) and the import here fails:Adafruit_CircuitPython_BusDevice/adafruit_bus_device/spi_device.py
Line 20 in 519bf36
Causing this line to fail:
Adafruit_CircuitPython_BusDevice/adafruit_bus_device/spi_device.py
Line 76 in 519bf36
This started happening with adafruit/Adafruit_CircuitPython_Typing#42 as it introduced importing
adafruit_bus_device.spi_device.SPIDevice
.