There are various ways of running a command at startup, but you do need to make sure of certain things first:
- Check the permissions of your file, if you think they are correct, temporarily change them to 777 (
chmod 777 /path/to/script) and try that
- Make sure the command/script works manually, which you have done
- Make sure that the command/script either runs in the background or exits quickly as most methods of running a command/script at startup require that the command/script exits before moving on to the next.
If none of these things help, you may want to look into crontab
You can edit crontab with:
sudo crontab -u pi -e
and add:
@reboot python /home/pi/kiosk.py
assuming your command/script exits, if your command/script is a long running one, there are many ways of putting it in the background. My personal favorite is running it in a screen so you can re-access it later. Just change that line to:
@reboot screen -d -m -S Kiosk python /home/pi/kiosk.py
Once your booted, you can check to see if your script is running by entering the command screen -ls and resume it by entering screen -r Kiosk, to leave the screen but leave it running hit Control A and Control D.
EDIT
I think I see your problem now. If you are trying to run a script that uses GUI at startup, there can be issues. The GUI doesn't start for a while after the boot, and almost all methods of running commands/scripts at boot runs them almost immediately. This means you will need a delay.
EX, for crontab
@reboot sleep 60; screen -d -m -S Kiosk python /home/pi/kiosk.py
This waits 60 seconds after the boot to run the script. You may need to wait longer or shorter depending on how fast your boot is. Time your boot and change the 60 to the appropriate time in seconds.