Unable to launch python script on startup

June 27, 2024, 18:59

goon3390

I orignially have my script starting up on boot via adding it to "sudo crontab -e", now ive gotten a new pi (same model and ver) yet it dosent work, i have tried a few other options yet none seem to quite work?

thunder07337

Is the script executable?

goon3390

it is a .py

goon3390

sorry i should of said that

goon3390

permission to execute it is set to everyone

thunder07337

Only to everyone?

oops.se

There are two different crontab one that run the "global/system" crontab and then you have a user specific crontab. And the "systems crontab" doesn't have the same environment as the "users crontab". A workaround this is to specify the user in the systems crontab with the command, ex: * username /path/to/your/script.py Or you can put the script into the "users crontab" file by editing the "users crontab", ex: sudo crontab -u username -e

goon3390

i tried both of these yet they dont work, i assume im meant to put something instead of the * in the first command? and the users crontab didnt work :/ i was thinking of converting it to a shell script and trying to run it that way? but idk if that would be the correct thing to do

oops.se

An advice, as you can't see what is happening I often implement logging in the script so I know where it fails. As it is now is like to help a blind man over a crossing and the blind man doesn't know where he want's to go. You need to provide more info (code) and do logging as to trouble shoot your issues.

goon3390


goon3390


goon3390

(old but didnt work either way)

goon3390

the python script itself runs fine

goon3390

rather its just getting it to run on startup

goon3390

i can always launch it mnaully afterrwards and it always works

goon3390


goon3390


goon3390

ii can compile it yet no joy there either

goon3390

cant build it

goon3390


goon3390

no python :/

goon3390


oops.se

And pictures of text is something I cant read that well !