lvgl / lv_binding_micropython

LVGL binding for MicroPython
MIT License
237 stars 156 forks source link

Unix port on macOS: Initializing SDL interferes with network requests #248

Closed sylvinus closed 1 year ago

sylvinus commented 1 year ago

Hello,

I'm using the latest (89c3b394344c22e19fe166133407b84c245aa481) build of lv_micropython, having followed the README instructions for macOS.

I have come up with a small reproduction of the issue:

import socket
import SDL

# Uncommenting this lines causes the s.connect() call to fail with OSError 56
# SDL.init()

ai = socket.getaddrinfo("info.cern.ch", 80)
s = socket.socket()
s.connect(ai[-1][-1])
s.send(b"GET / HTTP/1.0\r\nHost: info.cern.ch\r\n\r\n")
print(s.recv(50*1024).decode("ascii"))
s.close()

Indeed, when uncommenting the SDL.init() line I get this:

Traceback (most recent call last):
  File "crash.py", line 8, in <module>
OSError: 56

Any idea what is happening? It is unclear to me where to trace that 56 error code.

Thanks!!

amirgon commented 1 year ago

Hi @sylvinus !

Your script does not work as is (always returning "OSError: 97").
I had to change s.connect(ai[-1][-1]) into s.connect(ai[0][-1]) After making this change, it works as expected either with SDL.init() or without it, so I'm not able to reproduce your problem.

However, I'm running this on Linux (Ubuntu 20.04.5 LTS), so it might be some Mac specific thing.