rogro82 / hass-variables

Home Assistant variables component
238 stars 58 forks source link

Python 3.10 - wait() got an unexpected keyword argument 'loop' #66

Open rwarner opened 1 year ago

rwarner commented 1 year ago

Just upgraded to 2023.2.0 and also upgraded to Python 3.10.9 and it appears that I run into an error with some Python incompatibility:

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv_3.10.9/lib/python3.10/site-packages/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/homeassistant_venv_3.10.9/lib/python3.10/site-packages/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/srv/homeassistant/homeassistant_venv_3.10.9/lib/python3.10/site-packages/homeassistant/core.py", line 1787, in async_call
    task.result()
  File "/srv/homeassistant/homeassistant_venv_3.10.9/lib/python3.10/site-packages/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/home/homeassistant/.homeassistant/custom_components/variable/__init__.py", line 126, in async_set_variable_service
    yield from asyncio.wait(tasks, loop=hass.loop)
TypeError: wait() got an unexpected keyword argument 'loop'

Doesn't seem like this will be fixed given the other issues filed for this repo. Will be seeking an alternative for storing variables for HASS globally and will update here.

rwarner commented 1 year ago

I went into custom_components/variable/__init__.py and changed

line 126 from:

yield from asyncio.wait(tasks, loop=hass.loop)

to

yield from asyncio.wait(tasks)

and now it seems to be working for the time being fyi. Something different with the support in aiohttp or python

sbrewster2 commented 1 year ago

Had the same problem, applied your fix and works for me too.

Thx

rwarner commented 1 year ago

Had further issues with Python 3.11, moved over to: https://github.com/Wibias/hass-variables