I am having troubles running a python server script at startup on my RPi 3 B+.
I created a python file and placed it in
/home/pi/Desktop/scripts/bulb.py, it contains the python interpreter should be used in the start
(#!/usr/bin/python3) and has proper permissions
(chmod 777 bulb.py).
/home/pi/Desktop/scripts/bulb.py at the terminal, the server runs fine. I created a systemd service as following:
[Unit] Description=The bulb server After=network-online.target [Service] ExecStart=/home/pi/Desktop/scripts/bulb.py [Install] WantedBy=multi-user.target
and then ran
sudo systemctl enable bulbserver in order to enable it.
However, when rebooting, it is not running and when running
systemctl status bulbserver I can see the script is exited because of an error "ImportError: No module named 'yeelight'", I am using this module, but why when running the file from the terminal it works but when systemd tries to run it, it failes with apparently a different interpreter?