Python Forum

Full Version: run python script on startup?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello ,
I have create a python code that wait for a press of a button then send a UDP
the code is running without any problem when I run it from the cmd.
but when I try to make it run on boot - it doesn't even start
any idea why?

his is what I did :
in the /etc/rc.local


'/home/pi/Documents/starup.sh'
'exit 0'  
and the the startup.sh is

#!/bin/sh
sleep 30
python /home/pi/mu_code/MyProgram/PressButtonShowMsg.py
Try to use Cron,then can call Python file directly without using shell script.
sudo crontab -e
Add:
@reboot python /home/pi/mu_code/MyProgram/PressButtonShowMsg.py &
Restart sudo reboot