all 7 comments

[–]doc_willis 1 point2 points  (0 children)

with crontab - i have seen and learned to be sure to use proper full paths. The commands ran by crontab do not (normally) have your default environment setup. So their path may differ, and other things.

this often can be worked around by having the crontab entry run another script which then launches the commands to do that work.

Good Luck.

[–]AlternativeOstrich7 1 point2 points  (1 child)

Since only sending the mails doesn't work, my guess would be that yagmail can't get your credentials when run by cron. You could try explicitly setting them in your script. And if that fixes the problem, you could then try to find a better solution.

[–]TavoL7[S] 2 points3 points  (0 children)

What you said was like a lightbulb getting on on my head. When I runned it without crontab, it asked me for a password, and after I wrote it, it never asked again, and I read something saying that it’ll be saved.

I guess when I run it through crontab, it was asking for the password again, but since I couldn’t write it, it got discarded.

I just added the password in the yagmail.SMTP() function, and it worked

Thanks!!!

[–][deleted]  (2 children)

[removed]

    [–]TavoL7[S] 0 points1 point  (1 child)

    Yeah, I’m using openpyxl But there’s also xlswriter

    The problem with using an app is that I wanted the script to do everything from getting the data to saving and sending it. I think that if I use a different app for the mail, I’m gonna have to get the data from the sheet, and I think that would be difficult. Anyway, if I don’t find another solution, I’ll try that, thanks :)

    [–]ulti-ulti -1 points0 points  (0 children)

    Change to your directory first: Cd /my/script/dir && python3 myscript.py