You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2024-10-11 22:03:31.301 DEBUG (MainThread) [custom_components.pyscript.eval] file.lights-room.lights_room: calling __aexit__(<aiohttp.client.ClientSession object at 0x7f511cca10>, <class 'TypeError'>, object dict can't be used in 'await' expression, <traceback object at 0x7f3ed66600>, {})
I have matching aiohttp versions, running Python 3.12.4 inside a venv on a Mac:
@serviceasyncdeflights_room():
asyncwithaiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=ssl_context)) assession:
try:
asyncwithsession.get(
f"{uri}/endpoint",
headers={...}
) asresponse:
response.raise_for_status()
data=awaitresponse.json()
# ^ this await is required when running the script on a Mac. However pyscript throws an error here.
The pyscript environment requires me to remove the await in the response.json() line, otherwise I get an error mentioned above. Running the script on my laptop requires the awaot. I read somewhere that the awaits are "optional", but doesn't seem so.
I run the script on the laptop via asyncio.run(lights_room()), which I guess is not the same way pyscript does it?
anyway the current workaround is to adjust the script for the pyscript env and remove the awaits.
The text was updated successfully, but these errors were encountered:
I have matching aiohttp versions, running Python 3.12.4 inside a venv on a Mac:
The pyscript environment requires me to remove the
await
in theresponse.json()
line, otherwise I get an error mentioned above. Running the script on my laptop requires the awaot. I read somewhere that the awaits are "optional", but doesn't seem so.I run the script on the laptop via
asyncio.run(lights_room())
, which I guess is not the same way pyscript does it?anyway the current workaround is to adjust the script for the pyscript env and remove the awaits.
The text was updated successfully, but these errors were encountered: