-
Notifications
You must be signed in to change notification settings - Fork 11
Print error about missing waveform library #29
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
Conversation
After sleeping on it I think it may be best to re-raise the ImportError instead of just printing it out. This will cause it to crash and give the exact reason as to why which is the typical behavior when missing an import. I'll add a new commit today to raise instead of print the ImportError. |
I'm not sure why Sphinx was failing with:
The waveform library is listed in requirements.txt and seems to have gotten installed correctly according to the logs from the actions run. But for some reason Sphinx was unable to to use it from there it seems. I've added After the latest commits this change will now raise the ImportError in cases where
Tested successfully on PyPortal with 7.1.0 beta. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to move the AUDIOIO_AVAILABLE = True
above the adafruit_waveform
import. In it's current state audioio could successfully import but report that AUDIOIO_AVAILABLE
is not available because of an issue with waveform sine.
It should still error out because of the except ImportError as e
on line 34, but if further down the line something in the code changes later on it could cause confusion.
@KeithTheEE good catch, thanks for the review! Latest commit moves setting I also figured it would make sense to be consistent in the naming of the variables so I renamed the waveform one to |
Could you try one more thing for me? Don't include I'm afraid it'll continue like everything is normal and crash much later on because the only reason this raises the exception is if |
Nevermind, that's true to the original behavior, my bad. This looks good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it should fail only when appropriate, and should correctly explain what was missing.
Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.9.6 from 3.9.5: > Merge pull request adafruit/Adafruit_CircuitPython_GPS#76 from mrdalgaard/main > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 6.1.0 from 6.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#116 from joebaird/main > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Seesaw to 1.10.4 from 1.10.3: > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#90 from todbot/main > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes to 2.4.1 from 2.4.0: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#45 from dhalbert/make-package Updating https://github.com/adafruit/Adafruit_CircuitPython_RTTTL to 2.4.10 from 2.4.9: > Merge pull request adafruit/Adafruit_CircuitPython_RTTTL#29 from FoamyGuy/pyportal_fix Updating https://github.com/adafruit/Adafruit_CircuitPython_TinyLoRa to 2.2.5 from 2.2.4: > update rtd py version
This resolves: #28
The root cause was that audioio did exist but I did not properly load the
adafruit_waveform
library which gets caught by the same except block that is checking for audioio. That caused the library to fall back to pwm which is invalid for the PyPortals pin so raising the exception from that makes sense.This PR adds a more clear message to let the user know specifically that they do have
audioio
but are missing theadafruit_waveform
library.