How can I get KODI and a Python script to run at the same time?
#1
I have created a small programme in Python 3 (3.7.3) to monitor the supply voltage of the uninterruptible power supply (UPS). If the voltage is switched off, the system should be shut down in a controlled manner. 
  
  • First I called KODI and the Python script from 'autostart' (/etc/xdg/lxsession/LXDE-pi/autostart) and realised that only KODI is running and the script is not.
     Autostart: 
    @kodi 
    @lxterminal -e python3 /home/pi/pi4/python/usvStromPi3Status.py 
    @lxpanel --profile LXDE-pi 
    @pcmanfm --desktop --profile LXDE-pi 
    @xscreensaver -no-splash

  • Then I called KODI from my script after running two monitoring loops. When KODI started, the script froze and continued exactly where it left off when KODI was stopped. 
  • I then started KODI from the menu (Menu --> Entertainment media --> KODI) and, strangely enough, both programmes worked in parallel. 
 
So my question is: How can I get both programmes to start automatically and run in parallel? 
  
 
Running on: Raspi 4
Raspbian release: 10 Buster
Kodi Version: 18.7
Reply
#2
Your Python script needs to run as a service which can run in the background.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
try the raspberry pi forum, this is more a system config than a kodi one
https://forums.raspberrypi.com/viewtopic.php?t=294014
Reply
#4
(2024-02-25, 17:51)izprtxqkft Wrote: try the raspberry pi forum, this is more a system config than a kodi one
https://forums.raspberrypi.com/viewtopic.php?t=294014

Thanks.  I was making an assumption the questioner was trying to run the scripts within Kodi which, after reading again, may not be the case.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#5
Thanx, Jeff.

I was thinking about, that I must run it somehow on another 'stage', but did not know how.
Found a good Documentation here:

https://gist.github.com/emxsys/a507f3cad...ac28e2990f

Only had to replace /usr/bin/python by /usr/bin/python3.7

Mick
Reply

Logout Mark Read Team Forum Stats Members Help
How can I get KODI and a Python script to run at the same time?0