custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
818 stars 43 forks source link

Since the last update of HASS the following warning is written in the log a each script call #609

Open VikingGer opened 3 weeks ago

VikingGer commented 3 weeks ago

Home Assistant Core 2024.6.1 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240605.0

The script itself seems to work, however.

2024-06-09 14:32:36.157 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'pyscript' at custom_components/pyscript/eval.py, line 1941: return func(*args, kwargs) (offender: /usr/local/lib/python3.12/site-packages/Adafruit_PureIO/smbus.py, line 140: self._device = open(f"/dev/i2c-{bus}", "r+b", buffering=0)), please create a bug report at https://github.com/custom-components/pyscript/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/config/custom_components/pyscript/function.py", line 448, in run_coro result = await coro File "/config/custom_components/pyscript/trigger.py", line 1266, in do_func_call await ast_ctx.call_func(func, None, *kwargs) File "/config/custom_components/pyscript/eval.py", line 1911, in call_func return await func.call(self, args, kwargs) File "/config/custom_components/pyscript/eval.py", line 770, in call val = await self.try_aeval(ast_ctx, arg1) File "/config/custom_components/pyscript/eval.py", line 679, in try_aeval return await ast_ctx.aeval(arg) File "/config/custom_components/pyscript/eval.py", line 910, in aeval val = await getattr(self, name, self.ast_not_implemented)(arg) File "/config/custom_components/pyscript/eval.py", line 1438, in ast_assign rhs = await self.aeval(arg.value) File "/config/custom_components/pyscript/eval.py", line 910, in aeval val = await getattr(self, name, self.ast_not_implemented)(arg) File "/config/custom_components/pyscript/eval.py", line 1896, in ast_call return await self.call_func(func, func_name, *args, *kwargs) File "/config/custom_components/pyscript/eval.py", line 1941, in call_func return func(args, **kwargs)

ALERTua commented 3 weeks ago

similar to #608

rccoleman commented 6 days ago

As of 2024.7, scandir is now causing similar warnings in the log:

2024-06-30 10:17:47.741 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to scandir with args (b'/config/pyscript/apps',) inside the event loop by custom integration 'pyscript' at custom_components/pyscript/__init__.py, line 335: observer.start() (offender: <frozen os>, line 366: ?), please create a bug report at https://github.com/custom-components/pyscript/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#scandir