Forums

Script not working in Scheduled Task

I've got a script that scrapes emails from Gmail, does stuff with the attachments, and then forwards them off. It works great when I run it from the BASH terminal created in my final folder:

python3.8 scrapegmail.py

however, when i run it as a scheduled task it seems to get all gummed up in permissions. The script fires, but won't finish. I've tried to replicate it from a BASH terminal generated from the dash board and i get the same problems. I'm using:

python3.8 /home/myusername/myprojectfolder/scrapegmail.py

I'm assuming it has to do with the IP addresses of the servers that run each console? Is it a different server if run a console from within myprojectfolder, vs the scheduled task/dashboard?

How do i fix this?

See the section titled "Make sure you take account of the working directory" here https://help.pythonanywhere.com/pages/ScheduledTasks/

Thank you! That fixed it!