Closed jfurcean closed 3 years ago
This looks like a failure to close sockets. The below example crashes on the third request.
from adafruit_magtag.magtag import MagTag
magtag = MagTag()
magtag.network.connect()
requests = magtag.network.requests
urls = ["https://wired.com/", "https://www.test.com/","https://apple.com/"]
for url in urls:
print(url)
resp = requests.get(url)
resp.close()
Traceback (most recent call last):
File "code.py", line 12, in <module>
File "adafruit_requests.py", line 616, in get
File "adafruit_requests.py", line 575, in request
File "adafruit_requests.py", line 445, in _get_socket
File "adafruit_requests.py", line 441, in _get_socket
RuntimeError: Out of sockets
Just for completeness, it's unrelated to MagTag. This also gets Out of sockets
:
import wifi
import socketpool
import ssl
import adafruit_requests
from secrets import secrets
wifi.radio.connect(secrets['ssid'], secrets['password'])
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
urls = ["https://wired.com/", "https://www.test.com/", "https://apple.com/"]
for url in urls:
print(url)
resp = requests.get(url)
resp.close()
This should be fixed by PR #74.
The MagTag Google Calendar Event Display Learn Guide is crashing with the following trace using CircuitPython 6.2.0-beta.2 and the latest libraries.