Running a python script on raspbian every min, here the crontab line:* * * * * /usr/bin/python3 /something/code.py >> /something/code.txtHowever, code.txt shows me that it stops halfway in the code. I.e:Hello 1Hello 2When run manually, I get more hello's, no errors. Things I've done:Added: #!/usr/bin/python3 to top of scriptchmod +x the scriptused just python3 vs /usr/bin/python3Ran a sample **** (echo hello world >> text.txt) and it works, but python doesn't work :(Any idea why? Thanks!
Crontab stops halfway
cron
Probably your script needs some environmental variables that crontab doesn't set by default. Keep in mind that crontab environment variables are very limited.There are several approaches to set your environment variables in cron:Set each variable you need in your script.Export a completer PATH than the default set by your contrab at the beginning of your script or before calling your script in crontab.Source your profile: . $HOME/.profile.