Hello everybody
How can I start a python script on boot?
I tried adding a bash command on rc.local, it doesn’t work.
I tried to create a service, it doesn’t work.
it should work in both cases, I’ve been using those approaches for initializing my BassOwl-HAT before having a proper Linux driver
pay attention to declare the full path for both python and script, something like that
/usr/bin/python /usr/bin/tas5825m_init.py
here you have an example of a script that creates a python script and installs a service that runs the script on boot
https://raw.githubusercontent.com/Darmur/bassowl-hat/master/scripts/install_tas5825m_24V_volumio.sh
Oct 22 19:52:51 volumio rc.local[587]: import mpd
Oct 22 19:52:51 volumio rc.local[587]: ModuleNotFoundError: No module named ‘mpd’
Oct 22 20:06:18 volumio rc.local[596]: import RPi.GPIO as GPIO
Oct 22 20:06:18 volumio rc.local[596]: ModuleNotFoundError: No module named ‘RPi’
I think you have problems in your script, not in the way you launch it.
It looks like you don’t have all the required python modules in your system.
did you try to launch the script directly from terminal?