I'm running https://learn.adafruit.com/weather-display-matrix and every so often the script locks up and the display freezes. Sometimes a couple of times a day or sometimes it will go for days before this happens.
Any idea what is causing this and how to correct it?
Retrieving data...Traceback (most recent call last):
File "code.py", line 99, in <module>
File "code.py", line 93, in <module>
File "adafruit_portalbase/network.py", line 548, in fetch_data
File "adafruit_portalbase/network.py", line 467, in fetch
File "adafruit_requests.py", line 684, in get
File "adafruit_requests.py", line 586, in request
OutOfRetries: Repeated socket failures
It looks like there have been signicant changes to the codebase you are erroring out on. The repeated socket failures are going through the adafruit_portalbase CircuitPython library. Can you make sure all your CircuitPython libraries are up to date. This is the latest on the repo you can read about. I would install using the libraries link at the bottom.
Retrieving data...Traceback (most recent call last):
File "code.py", line 93, in <module>
File "adafruit_portalbase/network.py", line 548, in fetch_data
File "adafruit_portalbase/network.py", line 467, in fetch
File "adafruit_requests.py", line 684, in get
File "adafruit_requests.py", line 586, in request
OutOfRetries: Repeated socket failures
Code done running.
I've tried 6.3 stable with the updated libraries (21-06-25) and still problems. So I decided to give version 7.0 alpha 3 a go,know it is not stable, but there is no difference.
Are you keeping the libraries bundle version matched up with the 6.x and 7.x CircuitPython releases? eg. We do not want you to try and use a 6.x library with a 7.x CircuitPython release and vice-versa.
Looking at the source code for adafruit_requests.py I'm wondering if the timeout option would help.
# We may fail to send the request if the socket we got is closed already. So, try a second
# time in that case.
retry_count = 0
while retry_count < 2:
retry_count += 1
socket = self._get_socket(host, port, proto, timeout=timeout)
ok = True
try:
self._send_request(socket, host, method, path, headers, data, json)
except (_SendFailed, OSError):
ok = False
if ok:
# Read the H of "HTTP/1.1" to make sure the socket is alive. send can appear to work
# even when the socket is closed.
if hasattr(socket, "recv"):
result = socket.recv(1)
else:
result = bytearray(1)
try:
socket.recv_into(result)
except OSError:
pass
if result == b"H":
# Things seem to be ok so break with socket set.
break
self._close_socket(socket)
socket = None
if not socket:
raise OutOfRetries("Repeated socket failures")
A final option to consider is updating the esp32 firmware on the MatrixPortal. We have a guide for that.
The MatrixPortal uses the ESP32 just for WiFi. We have a UF2 image that you should be able to drop in place for the upgrade based on the previous guide link I sent. Here is the direct link to the UF2 image.
Is it possible to place a static IP Address into the MatrixPortal so that it grabs the same IP Address every time? I think the problem I'm having in this thread is my network and see this type of drop with the PyPortal as well.
What you could do is determine the mac address of your esp32s2 device using the above library and set your home access point to always hand out the same IP to that mac address.
I am still getting these errors on the MatrixPortal using CP 6.3.0. They happen about once every 2 or 3 days. I was using CP 7.0.0, but the same problem happened once or twice a day.
Getting time from internet!
Getting time for timezone America/Edmonton
Traceback (most recent call last):
File "code.py", line 88, in <module>
File "code.py", line 84, in <module>
File "adafruit_portalbase/network.py", line 231, in get_local_time
File "adafruit_portalbase/network.py", line 214, in get_strftime
File "adafruit_portalbase/network.py", line 200, in get_strftime
File "adafruit_requests.py", line 684, in get
File "adafruit_requests.py", line 586, in request
OutOfRetries: Repeated socket failures
Code done running.
print("Connecting to AP...")
while not esp.is_connected:
try:
esp.connect_AP(secrets["ssid"], secrets["password"])
except RuntimeError as e:
print("could not connect to AP, retrying: ", e)
continue
print("Connected to", str(esp.ssid, "utf-8"), "\tRSSI:", esp.rssi)
The forums are focused on getting people going with the necessary hardware and software setup. If there is a possible bug with CircuitPython or a library we often recommend going to the github repo and opening an issue.
The closest error I've seen to yours is from the github repo Adafruit_CircuitPython_Requests, but it turned out to be a routing issue on the users side.