diff --git a/Adafruit_IO_Air_Quality/code.py b/Adafruit_IO_Air_Quality/code.py index c9aba8c77..734b97695 100755 --- a/Adafruit_IO_Air_Quality/code.py +++ b/Adafruit_IO_Air_Quality/code.py @@ -168,7 +168,7 @@ while True: # Hourly reset if cur_time.tm_min == 0: prv_mins = 0 - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to fetch time, retrying\n", e) wifi.reset() wifi.connect() @@ -200,7 +200,7 @@ while True: io.send_data(feed_temperature["key"], str(temperature)) io.send_data(feed_humidity["key"], str(humidity)) print("Published!") - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to send data to IO, retrying\n", e) wifi.reset() wifi.connect() diff --git a/Adafruit_IO_Power_Relay/code.py b/Adafruit_IO_Power_Relay/code.py index 747f3312c..9d055cd86 100755 --- a/Adafruit_IO_Power_Relay/code.py +++ b/Adafruit_IO_Power_Relay/code.py @@ -129,7 +129,7 @@ client.subscribe(feed_relay) while True: try: # Poll for new messages on feed_relay client.loop() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() client.reconnect() diff --git a/Adafruit_IO_Power_Relay/code_light_sensor/code.py b/Adafruit_IO_Power_Relay/code_light_sensor/code.py index 6d8f3f34a..fd321bc09 100755 --- a/Adafruit_IO_Power_Relay/code_light_sensor/code.py +++ b/Adafruit_IO_Power_Relay/code_light_sensor/code.py @@ -169,7 +169,7 @@ while True: print("Published!") prv_sensor_value = sensor_value start_time = now - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() client.reconnect() diff --git a/Adafruit_IO_Schedule_Trigger/code.py b/Adafruit_IO_Schedule_Trigger/code.py index 36158e66b..43c056d84 100755 --- a/Adafruit_IO_Schedule_Trigger/code.py +++ b/Adafruit_IO_Schedule_Trigger/code.py @@ -141,7 +141,7 @@ io.get("relay") while True: try: io.loop() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() io.reconnect() diff --git a/Bitcoin_Matrix/code.py b/Bitcoin_Matrix/code.py index 3e1e5ee16..2a634c8c4 100755 --- a/Bitcoin_Matrix/code.py +++ b/Bitcoin_Matrix/code.py @@ -51,7 +51,7 @@ while True: try: value = matrixportal.fetch() print("Response is", value) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(3 * 60) # wait 3 minutes diff --git a/Feather_ESP32-S2_TFT_Azure/code.py b/Feather_ESP32-S2_TFT_Azure/code.py index 6e3ae48c8..905e15acb 100644 --- a/Feather_ESP32-S2_TFT_Azure/code.py +++ b/Feather_ESP32-S2_TFT_Azure/code.py @@ -216,8 +216,8 @@ while True: device.loop() # if something disrupts the loop, reconnect # pylint: disable=broad-except - except (ValueError, RuntimeError, OSError, Exception) as e: - print("Connection error, reconnecting\n", str(e)) + except (ValueError, RuntimeError, OSError, ConnectionError) as e: + print("Network error, reconnecting\n", str(e)) supervisor.reload() continue # delay diff --git a/MagTag_AdafruitQuotes/code.py b/MagTag_AdafruitQuotes/code.py index 8996a83ec..02abc514a 100644 --- a/MagTag_AdafruitQuotes/code.py +++ b/MagTag_AdafruitQuotes/code.py @@ -36,6 +36,6 @@ while True: try: value = magtag.fetch() print("Response is", value) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) timestamp = time.monotonic() diff --git a/MagTag_Cheerlights/code.py b/MagTag_Cheerlights/code.py index 01ff36eae..da5d2ae12 100644 --- a/MagTag_Cheerlights/code.py +++ b/MagTag_Cheerlights/code.py @@ -43,6 +43,6 @@ while True: magtag.peripherals.neopixels.fill(color) external_pixels.fill(color) timestamp = time.monotonic() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(1) diff --git a/MagTag_Cheerlights_LED_Animations/code.py b/MagTag_Cheerlights_LED_Animations/code.py index 9c30f7ca9..25983cf3b 100755 --- a/MagTag_Cheerlights_LED_Animations/code.py +++ b/MagTag_Cheerlights_LED_Animations/code.py @@ -137,7 +137,7 @@ while True: ) timestamp = time.monotonic() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: # Catch any random errors so the code will continue running. print("Some error occured, retrying! -", e) try: diff --git a/MagTag_CountdownCelebration/code.py b/MagTag_CountdownCelebration/code.py index 2d3cc411c..8a83d3385 100644 --- a/MagTag_CountdownCelebration/code.py +++ b/MagTag_CountdownCelebration/code.py @@ -60,7 +60,7 @@ while True: seconds = int(datetime_str[17:19]) rtc.RTC().datetime = time.struct_time((year, month, mday, hours, minutes, seconds, 0, 0, False)) lasttimefetch_stamp = time.monotonic() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) continue diff --git a/MagTag_CovidTracking/code.py b/MagTag_CovidTracking/code.py index 1ef30c2fa..06b7d8e9b 100644 --- a/MagTag_CovidTracking/code.py +++ b/MagTag_CovidTracking/code.py @@ -95,7 +95,7 @@ try: # OK we're done! magtag.peripherals.neopixels.fill(0x000F00) # greten -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, trying again later -", e) time.sleep(2) # let screen finish updating diff --git a/MagTag_Covid_Vaccination/code.py b/MagTag_Covid_Vaccination/code.py index 423c644b1..ca97d20df 100644 --- a/MagTag_Covid_Vaccination/code.py +++ b/MagTag_Covid_Vaccination/code.py @@ -112,7 +112,7 @@ try: SECONDS_TO_SLEEP = 24 * 60 * 60 # Sleep for one day -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying in one hour! -", e) seconds_to_sleep = 60 * 60 # Sleep for one hour diff --git a/MagTag_Killed_By_Google/code.py b/MagTag_Killed_By_Google/code.py index 195b83f34..2170effa7 100644 --- a/MagTag_Killed_By_Google/code.py +++ b/MagTag_Killed_By_Google/code.py @@ -95,5 +95,5 @@ while True: PAUSE = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 60 * 60) alarm.exit_and_deep_sleep_until_alarms(PAUSE) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) diff --git a/MagTag_NYC_Positivity/code.py b/MagTag_NYC_Positivity/code.py index 4a6a06679..8d3f39d61 100644 --- a/MagTag_NYC_Positivity/code.py +++ b/MagTag_NYC_Positivity/code.py @@ -43,7 +43,7 @@ while True: qn_idx = header.index("Queens") si_idx = header.index("Staten Island") nyc_idx = header.index("Citywide") - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) continue diff --git a/MagTag_Progress_Displays/weblate_translated_percent/code.py b/MagTag_Progress_Displays/weblate_translated_percent/code.py index 19bef5708..6f2ac5a8c 100644 --- a/MagTag_Progress_Displays/weblate_translated_percent/code.py +++ b/MagTag_Progress_Displays/weblate_translated_percent/code.py @@ -85,6 +85,6 @@ try: progress_bar.progress = value[1] / 100.0 magtag.refresh() magtag.exit_and_deep_sleep(24 * 60 * 60) # one day -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occurred, retrying! -", e) magtag.exit_and_deep_sleep(60) # one minute diff --git a/MagTag_Progress_Displays/year_progress_percent/code.py b/MagTag_Progress_Displays/year_progress_percent/code.py index 4d6d35a85..2570f0075 100644 --- a/MagTag_Progress_Displays/year_progress_percent/code.py +++ b/MagTag_Progress_Displays/year_progress_percent/code.py @@ -67,6 +67,6 @@ try: print(now) magtag.exit_and_deep_sleep(24 * 60 * 60) # one day -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occurred, retrying after 1 minute! -", e) magtag.exit_and_deep_sleep(60) # one minute diff --git a/MagTag_Quote_Board/code.py b/MagTag_Quote_Board/code.py index 9a5f0649a..125312c58 100644 --- a/MagTag_Quote_Board/code.py +++ b/MagTag_Quote_Board/code.py @@ -48,7 +48,7 @@ try: magtag.network.connect() value = magtag.fetch() print("Response is", value) -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: magtag.set_text(e) print("Some error occured, retrying later -", e) # wait 2 seconds for display to complete diff --git a/MagTag_Showerthoughts/code.py b/MagTag_Showerthoughts/code.py index 168721004..3632c4810 100644 --- a/MagTag_Showerthoughts/code.py +++ b/MagTag_Showerthoughts/code.py @@ -50,7 +50,7 @@ try: magtag.network.connect() value = magtag.fetch() print("Response is", value) -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: magtag.set_text(e) print("Some error occured, retrying! -", e) diff --git a/MagTag_SpaceX/code.py b/MagTag_SpaceX/code.py index b68e200bb..c56fdfb3a 100644 --- a/MagTag_SpaceX/code.py +++ b/MagTag_SpaceX/code.py @@ -84,7 +84,7 @@ magtag.add_text( magtag.add_text( text_font=terminalio.FONT, text_position=(10, 94), - line_spacing=0.8, + line_spacing=0.8, text_wrap=47, # wrap text at this count text_transform=details_transform ) @@ -95,7 +95,7 @@ try: # This statement gets the JSON data and displays it automagically value = magtag.fetch() print("Response is", value) -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) # wait 2 seconds for display to complete diff --git a/MagTag_Twitter/code.py b/MagTag_Twitter/code.py index bafc17995..92e02285e 100755 --- a/MagTag_Twitter/code.py +++ b/MagTag_Twitter/code.py @@ -68,7 +68,7 @@ magtag.preload_font() try: value = magtag.fetch() print("Response is", value) -except (ValueError, RuntimeError) as e: +except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(2) diff --git a/PyPortal_AWS_IOT_Planter/code.py b/PyPortal_AWS_IOT_Planter/code.py index 963a7a1cd..4b88dfaf2 100755 --- a/PyPortal_AWS_IOT_Planter/code.py +++ b/PyPortal_AWS_IOT_Planter/code.py @@ -172,6 +172,6 @@ while True: # Reset timer initial = now aws_iot.loop() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying", e) wifi.reset() diff --git a/PyPortal_AdafruitIO_Logger/code.py b/PyPortal_AdafruitIO_Logger/code.py index 2a4de0ff7..77d37ead8 100644 --- a/PyPortal_AdafruitIO_Logger/code.py +++ b/PyPortal_AdafruitIO_Logger/code.py @@ -88,7 +88,7 @@ while True: io.send_data(light_feed['key'], light_value) io.send_data(temperature_feed['key'], temperature, precision=2) print('Sent to Adafruit IO!') - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() continue diff --git a/PyPortal_Azure_Plant_Monitor/code.py b/PyPortal_Azure_Plant_Monitor/code.py index 3d17dfa07..832c14b6d 100755 --- a/PyPortal_Azure_Plant_Monitor/code.py +++ b/PyPortal_Azure_Plant_Monitor/code.py @@ -97,7 +97,7 @@ while True: gfx.display_azure_status("Data sent!") print("Data sent!") - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() wifi.connect() diff --git a/PyPortal_Bitcoin/bitcoin/code.py b/PyPortal_Bitcoin/bitcoin/code.py index c95265900..bfe873dbe 100644 --- a/PyPortal_Bitcoin/bitcoin/code.py +++ b/PyPortal_Bitcoin/bitcoin/code.py @@ -42,7 +42,7 @@ while True: try: value = pyportal.fetch() print("Response is", value) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(3*60) # wait 3 minutes diff --git a/PyPortal_Bitcoin/bitcoin_2/code.py b/PyPortal_Bitcoin/bitcoin_2/code.py index a0e124ec2..59cebccbc 100644 --- a/PyPortal_Bitcoin/bitcoin_2/code.py +++ b/PyPortal_Bitcoin/bitcoin_2/code.py @@ -46,7 +46,7 @@ while True: try: value = pyportal.fetch() print("Response is", value) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(3*60) # wait 3 minutes diff --git a/PyPortal_GCP_IOT_Planter/code.py b/PyPortal_GCP_IOT_Planter/code.py index c955c13d7..bc8e75645 100644 --- a/PyPortal_GCP_IOT_Planter/code.py +++ b/PyPortal_GCP_IOT_Planter/code.py @@ -189,7 +189,7 @@ while True: # Reset timer initial = now google_mqtt.loop() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, OSError, ConnectionError) as e: print("Failed to get data, retrying", e) wifi.reset() google_mqtt.reconnect() diff --git a/PyPortal_GithubStars/code.py b/PyPortal_GithubStars/code.py index 36519b63b..efab55c6e 100644 --- a/PyPortal_GithubStars/code.py +++ b/PyPortal_GithubStars/code.py @@ -51,7 +51,7 @@ while True: print("New star!") pyportal.play_file(cwd+"/coin.wav") last_value = value - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(60) # wait a minute before getting again diff --git a/PyPortal_IOT_Scale/code.py b/PyPortal_IOT_Scale/code.py index a4375fee3..800262910 100644 --- a/PyPortal_IOT_Scale/code.py +++ b/PyPortal_IOT_Scale/code.py @@ -104,7 +104,7 @@ while True: text_label.text = 'sending...' # send data to Adafruit IO (rounded to one decimal place) io.send_data(weight_feed['key'], round(reading.weight, 1)) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("failed to send data..retrying...") wifi.reset() continue diff --git a/PyPortal_LeagueLevel/code.py b/PyPortal_LeagueLevel/code.py index 78b95c655..e20c50118 100644 --- a/PyPortal_LeagueLevel/code.py +++ b/PyPortal_LeagueLevel/code.py @@ -52,7 +52,7 @@ while True: print("New level!") pyportal.play_file(cwd+"/triode_low_fade.wav") last_value = value - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occurred, retrying! -", e) #check again in two minutes time.sleep(60*2) diff --git a/PyPortal_Quarantine_Clock/code.py b/PyPortal_Quarantine_Clock/code.py index c8bcefcbd..dc776ebb6 100755 --- a/PyPortal_Quarantine_Clock/code.py +++ b/PyPortal_Quarantine_Clock/code.py @@ -90,7 +90,7 @@ while True: refresh_time = time.monotonic() # set the_time the_time = time.localtime() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) esp.reset() continue diff --git a/PyPortal_Quarantine_Clock/month_clock/code.py b/PyPortal_Quarantine_Clock/month_clock/code.py index 6aeb66455..afaf6a9c2 100644 --- a/PyPortal_Quarantine_Clock/month_clock/code.py +++ b/PyPortal_Quarantine_Clock/month_clock/code.py @@ -119,7 +119,7 @@ while True: refresh_time = time.monotonic() # set the_time the_time = time.localtime() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) esp.reset() continue diff --git a/PyPortal_Quotes/code.py b/PyPortal_Quotes/code.py index 0a349cfbb..c6231f15f 100644 --- a/PyPortal_Quotes/code.py +++ b/PyPortal_Quotes/code.py @@ -34,6 +34,6 @@ while True: try: value = pyportal.fetch() print("Response is", value) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(60) diff --git a/PyPortal_Reddit/code.py b/PyPortal_Reddit/code.py index cc9551700..c41864940 100644 --- a/PyPortal_Reddit/code.py +++ b/PyPortal_Reddit/code.py @@ -42,7 +42,7 @@ while True: print("New subscriber!") pyportal.play_file(cwd+"/coin.wav") last_value = value - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(60) diff --git a/PyPortal_Remote/code.py b/PyPortal_Remote/code.py index 437da87fb..fd5cde24c 100644 --- a/PyPortal_Remote/code.py +++ b/PyPortal_Remote/code.py @@ -88,7 +88,7 @@ def getchannels(): channel_dict[name] = chan_id response.close() return channel_dict - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data\n", e) wifi.reset() return None @@ -104,7 +104,7 @@ def sendkey(key): if response: response.close() print("OK") - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data\n", e) wifi.reset() return @@ -119,7 +119,7 @@ def sendletter(letter): if response: response.close() print("OK") - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data\n", e) wifi.reset() return @@ -135,8 +135,8 @@ def openchannel(channel): response.close() print("OK") response = None - except (ValueError, RuntimeError): - print("Probably worked") + except (ValueError, RuntimeError, ConnectionError, OSError) as e: + print("Probably worked, but got error\n", e) wifi.reset() response = None diff --git a/PyPortal_Smart_Thermometer/code.py b/PyPortal_Smart_Thermometer/code.py index 9a0dfd79b..e466723cd 100755 --- a/PyPortal_Smart_Thermometer/code.py +++ b/PyPortal_Smart_Thermometer/code.py @@ -105,7 +105,7 @@ while True: gfx.display_io_status('Data sent!') except AdafruitIO_RequestError as e: raise AdafruitIO_RequestError('IO Error: ', e) - except (ValueError, RuntimeError) as e: # WiFi Connection Failure + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() continue diff --git a/PyPortal_TwitterFollowers/code.py b/PyPortal_TwitterFollowers/code.py index c1283ce26..a21a7458b 100644 --- a/PyPortal_TwitterFollowers/code.py +++ b/PyPortal_TwitterFollowers/code.py @@ -45,7 +45,7 @@ while True: print("New follower!") pyportal.play_file(cwd+"/coin.wav") # uncomment make a noise! last_value = value - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Some error occured, retrying! -", e) time.sleep(60) # wait a minute before getting again diff --git a/PyPortal_UV_Index/code.py b/PyPortal_UV_Index/code.py index 6943b7e00..82a231360 100644 --- a/PyPortal_UV_Index/code.py +++ b/PyPortal_UV_Index/code.py @@ -82,7 +82,7 @@ while True: try: json_payload = pyportal.fetch() raw_data = json.loads(json_payload) - except (ValueError, RuntimeError) as ex: + except (ValueError, RuntimeError, ConnectionError, OSError) as ex: print('Error: ', ex) if isinstance(ex, ValueError): print('JSON:', json_payload) diff --git a/Smart_Alarm_Clock/code.py b/Smart_Alarm_Clock/code.py index dd34ac3bf..4e2c5a5d5 100644 --- a/Smart_Alarm_Clock/code.py +++ b/Smart_Alarm_Clock/code.py @@ -439,7 +439,7 @@ while True: else: pass gc.collect() - except (ValueError, RuntimeError) as err: + except (ValueError, RuntimeError, ConnectionError, OSError) as err: print("Failed to get data, retrying\n", err) wifi.reset() mqtt_client.reconnect() diff --git a/pyportal_pet_planter/code.py b/pyportal_pet_planter/code.py index 1b4629771..37d7de561 100755 --- a/pyportal_pet_planter/code.py +++ b/pyportal_pet_planter/code.py @@ -23,7 +23,8 @@ from simpleio import map_range #---| User Config |--------------- # How often to poll the soil sensor, in seconds -DELAY_SENSOR = 30 +# Polling every 30 seconds or more may cause connection timeouts +DELAY_SENSOR = 15 # How often to send data to adafruit.io, in minutes DELAY_PUBLISH = 5 @@ -179,7 +180,7 @@ label_status.text = "Connecting..." while not esp.is_connected: try: wifi.connect() - except RuntimeError as e: + except (RuntimeError, ConnectionError) as e: print("could not connect to AP, retrying: ",e) wifi.reset() continue @@ -269,7 +270,7 @@ while True: # to keep the connection active try: io.loop() - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying...\n", e) wifi.reset() continue @@ -314,7 +315,7 @@ while True: # reset timer initial = now - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: label_status.text = "ERROR!" print("Failed to get data, retrying...\n", e) wifi.reset() diff --git a/pyportal_weather_station/code.py b/pyportal_weather_station/code.py index 4dfa86d1c..c84462032 100755 --- a/pyportal_weather_station/code.py +++ b/pyportal_weather_station/code.py @@ -136,7 +136,7 @@ while True: print('Data sent!') except AdafruitIO_RequestError as e: raise AdafruitIO_RequestError('IO Error: ', e) - except (ValueError, RuntimeError) as e: + except (ValueError, RuntimeError, ConnectionError, OSError) as e: print("Failed to get data, retrying\n", e) wifi.reset() continue