Closed speccy88 closed 2 years ago
I have run into this kind of error when I forget to add a return
to my route handlers. Make sure you add the final line:
@web_app.route("/led_on/<r>/<g>/<b>")
def led_on(request, r, g, b):
print("led on!")
status_light.fill((int(r), int(g), int(b)))
return ("200 OK", [], [])
Even when you are handling a POST
:
@web_app.route("/led_on", ["POST"])
def led_on(request):
print("led on!")
r = request.query_params["r"]
g = request.query_params["g"]
b = request.query_params["b"]
status_light.fill((int(r), int(g), int(b)))
return ("200 OK", [], [])
The third parameter is the response content and it needs to be iterable, like an empty List, or even an empty string.
Can anyone tell me what could cause this error?
Traceback (most recent call last): File "code.py", line 107, in <module> File "adafruit_esp32spi/adafruit_esp32spi_wsgiserver.py", line 106, in update_poll File "adafruit_esp32spi/adafruit_esp32spi_wsgiserver.py", line 122, in finish_response TypeError: 'NoneType' object is not iterable