Closed
Description
I noticed I was getting an infinite loop when trying to pull data from a particular json source on the MatrixPortal that I wasn't getting on the MagTag. Is this expected behavior? Why isn't it just raising the MemoryError
?
Adafruit_CircuitPython_PortalBase/adafruit_portalbase/network.py
Lines 551 to 554 in 4e8bb18
Here is my test code which is just a modified version of the examples/matrixportal_simpletest.py
from Adafruit_CircuitPython_MatrixPortal
import time
import board
import terminalio
from adafruit_matrixportal.matrixportal import MatrixPortal
# Set up where we'll be fetching data from
DATA_SOURCE = "https://covid.cdc.gov/covid-data-tracker/COVIDData/getAjaxData?id=vaccination_data"
# 63 is USA
LOCATION_NUM = 63
DATE_LOCATION = ["vaccination_data", LOCATION_NUM, 'Date']
NAME_LOCATION = ["vaccination_data", LOCATION_NUM, 'LongName']
CENSUS_LOACTION = ["vaccination_data", LOCATION_NUM, 'Census2019']
ADMINISTER_1_LOCATION = ["vaccination_data", LOCATION_NUM, 'Administered_Dose1']
ADMINISTER_2_LOCATION = ["vaccination_data", LOCATION_NUM, 'Administered_Dose2']
matrixportal = MatrixPortal(
url=DATA_SOURCE,
json_path=(DATE_LOCATION, NAME_LOCATION,
CENSUS_LOACTION, ADMINISTER_1_LOCATION,
ADMINISTER_2_LOCATION),
)
while True:
try:
value = matrixportal.fetch()
print("Response is", value)
except (ValueError, RuntimeError) as e:
print("Some error occured, retrying! -", e)
time.sleep(3 * 60) # wait 3 minutes
Metadata
Metadata
Assignees
Labels
No labels