question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HA never restarts with pyscript activated

See original GitHub issue

I’m running HA 0.116.3 in a python3.8 venv on Ubuntu 18.04. Installed pyscript via HASS and tried both options, UI Integration and pyscript in configuration.yaml.

First script runs very well and i like it. BUT I cannot restart HA anymore. It looks like HA stops because there are no more new lines in home-assistant.log but my screen session where the hass process runs shows tons of tracebacks and i have to kill the process.

After removing from integration or in configuration.yaml, HA restart works normal.

...
Update for sensor.memory_use_percent fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for sensor.swap_use_percent fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for sensor.processor_use fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for media_player.mpd fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for media_player.mpd fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for weather.dark_sky fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for media_player.mpd fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.433_keller fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.lueften_keller fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.playstation4 fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.easyvdr_sound fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.beaglebone fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.e3dc fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Update for switch.terra_nas fails
Traceback (most recent call last):
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/srv/ha/lib/python3.8/site-packages/homeassistant/core.py", line 350, in async_add_executor_job
    task = self.loop.run_in_executor(None, target, *args)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 179, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
...

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
craigbarrattcommented, Oct 15, 2020

Ok, thanks, now I understand what the issue is. I thought it was not correctly restarting from the command-line (ie, quit and re-start hass manually), but you mean is doing a restart from the web interface. Yes, ^C not exiting the first time looks like a symptom of the same problem.

I can recreate this now. Thanks - now off to debugging…

0reactions
VDRainercommented, Oct 16, 2020

Issue is fixed, HA restarts. Thanks for this component and the fast fix.

there are a couple of places where you should cast state variables to int or float since in HASS all state variables are coerced into strings.

But it works. 😄

EDIT: You’re right. It didn’t raise an error, but it didn’t work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pyscript - new integration for easy and powerful Python ...
Pyscript is a new integration that allows you to write Python functions and scripts that can implement a wide range of automation, logic...
Read more >
python - How to make a script automatically restart itself?
It depends on what you mean by "restart itself." If you just want to continuously execute the same code, you can wrap it...
Read more >
Upgrading vCenter Server 7.0 fails during precheck with " ...
ESXi hosts running 7.0 U2c/U2d outside of a vLCM image-enabled ... In this case, please restart the upgrade and the precheck will pass...
Read more >
Manage device restarts after updates (Windows 10)
Use this policy to configure active hours, during which the device will not be restarted. This policy has no effect if the No...
Read more >
Systemd Restart=always is not honored
systemd won't attempt any more automatic restarts ever for units with Restart ... from which point on, the restart logic is again activated....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found