Skip to content

Reboot loop on MemoryError? #14

Closed
@jfurcean

Description

@jfurcean

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?

except MemoryError:
if supervisor is not None:
supervisor.reload()
raise

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions