For fun I’ve just got one of those Pimoroni Wireless Plasma Kits (with the star shaped bottle) and am playing around with it.
I noticed quite quickly that the included weather.py program doesn’t work in that it gets an initial weather report but then stays on that one forever after instead of updating every 15 minutes as it is clearly meant to.
Initial investigation shows that the first call to get_data() works, but every subsequent one (issued from a timer thread) fails with an ENOMEM error.
I shall be investigating this myself but I thought I’d mention it here in case anyone had any pointers.
The only modification I’ve made is to the latitude and longitude constants.
Perhaps not enough stack in the timer thread? (I’m not familiar with how the internals of Python work).
I’m currently playing with a modified version where the function invoked from the timer merely sets a global flag variable and then the main loop checks that and invokes get_data() again.
Further data point - doing a “gc.collect()” immediately before each attempted data retrieval also seems to make it work, even with the “https:” version of the URL.
I’m not sure of the implications of doing a garbage collection within a timer thread so I have tried this only in my version where the timer thread just sets a flag and then the invocation of get_data() is done from within the main loop.
CORRECTION: no it doesn’t. It works for about three times around, then we’re back to ENOMEM again.
Yeah, I played around with gc.collect() a little but it still seemed to fail a lot of the time with https . I wonder what has changed - pretty sure it was working before. Maybe Openmeteo have changed something on their end?