pimoroni / phew

MIT License
204 stars 44 forks source link

Task exception wasn't retrieved future: <Task> coro= <generator object '_handle_request' at 20015230> Traceback (most recent call last): File "asyncio/core.py", line 1, in run_until_complete File "/lib/phew/server.py", line 277, in _handle_request AttributeError: 'NoneType' object has no attribute 'status' #61

Open jevylux opened 4 months ago

jevylux commented 4 months ago

I have a problem with the following code running on a raspberry pico with the image RPI_PICO_W-20240602-v1.23.0.uf2

`from phew import connect_to_wifi, server from machine import Pin, PWM import json

import network_cred ip = connect_to_wifi(network_cred.SSID, network_cred.PASSWORD) print("Connected to IP", ip)

.....

@server.route("/api/control-led", methods=["POST"]) def ledCommand(request):

set_pwm_rgb(pwm_red, request.data["ledRed"])
set_pwm_rgb(pwm_green, request.data["ledGreen"])
set_pwm_rgb(pwm_blue, request.data["ledBlue"])
return json.dumps({"message": "Command sent successfully!"}), 200, {"Content-Type": "application/json"}

@server.catchall() def catchall(request): return "Not found", 404

server.run()`

When sending a POST request i get the following error :

Task exception wasn't retrieved future: coro= <generator object '_handle_request' at 20015230> Traceback (most recent call last): File "asyncio/core.py", line 1, in run_until_complete File "/lib/phew/server.py", line 277, in _handle_request AttributeError: 'NoneType' object has no attribute 'status'

andrewpbrooker commented 3 weeks ago

Hi

I am getting the same error as you

Did you get anywhere with it ?

Thanks

Andy

jevylux commented 3 weeks ago

Hi, i am on holiday right now. I will check when i am back home mid of next weekRegardsMarcSent from my iPhoneOn 14 Oct 2024, at 19:32, andrewpbrooker @.***> wrote: Hi I am getting the same error as you Did you get anywhere with it ? Thanks Andy

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>