belyalov / tinyweb

Simple and lightweight HTTP async server for micropython
MIT License
239 stars 40 forks source link

tinyweb not working above micropython ESP32 firmware 1.19 #56

Open staberas opened 7 months ago

staberas commented 7 months ago

ESP32C3 with firmware 1.20 -1.22 throws a uasyncio related error but the problem and solution is related with the micropython changes from v1.19.1 (which works) to 1.21-1.22

Description of problem: the traceback says the error occurs on the def _tcp_server function specifically on line 650 -> yield uasyncio.core._io_queue.queue_read(sock) it errors out there and if you try to load the page/ip location you get a connection refused on the browser.

FabianClemenz commented 5 months ago

@staberas @belyalov i have provided a fix https://github.com/belyalov/tinyweb/pull/57 which adds compatibility with micropython above version v1.19.0

@staberas as a quick workaround, simply remove the uasyncio imports at the top and import asyncio

And around the line 649 remove

if IS_UASYNCIO_V3:
   yield uasyncio.core._io_queue.queue_read(sock)
else:
   yield asyncio.IORead(sock)

and add

yield asyncio.core._io_queue.queue_read(sock)