Closed salleq closed 2 years ago
You just need to put the print after the if statement:
if "name 'pixel_ring' is not defined" in str(e):
if(os.getenv('RESPEAKER_CONNECTED')):
exit();
print("\nERROR: ReSpeaker is probably not connected?")
exit();
or better yet:
if "name 'pixel_ring' is not defined" in str(e) and os.getenv('RESPEAKER_CONNECTED'):
print("\nERROR: ReSpeaker is probably not connected?")
exit();
Reviewing the code again it looks like respeaker_errors(e)
shouldn't even be getting called if RESPEAKER_CONNECTED = False in your settings.env.... could it be getting called from another file?
if(os.getenv('RESPEAKER_CONNECTED')):
is returning a string which will always = true. I've updated the file with the following for all the if's but this idea will need to be carried into the other files where the getenv's are treated as booleans.
if(os.getenv('RESPEAKER_CONNECTED', 'False').lower() in ('true', '1', 't')):
This is something I had in mind (that it's always true) but didn't know how to change in Python.
Thanks guys, confirmed to be working. Closing this dealio
In glados_respeaker.py:
If I uncomment the two lines that I have commented above, I get the error "ReSpeaker is probably not connected" even though in settings.env there is: RESPEAKER_CONNECTED = False