Forums

Error occurring only when script is scheduled

I am using instabot to log into an instagram account. I am getting a 429 error while running my script only when it is scheduled. The script runs with no issues in console.

This is the error:

2021-07-21 19:45:54,990 - INFO - Not yet logged in starting: PRE-LOGIN FLOW!
2021-07-21 19:45:55,038 - ERROR - Request returns 429 error!
2021-07-21 19:45:55,038 - WARNING - That means 'too many requests'. I'll go to sleep for 5 minutes.

Like I said, this only happens when the task is scheduled, and will not happen when I run it in console.

Scheduled tasks are running from a different server. Looks like the IP of the server running tasks could is rate limited by instagram as multiple users use it to connect to Instagram. Make your code sleep and try again.

Thanks for the reply! Fortunately I was able to figure it out from another similar forum post. In case anyone else has this issue, cd'ing into the correct directory when scheduling the task is what fixed it for me(specifically for this one function that used Instabot, as the rest of my program up to that point ran normally, which is why I was so confused).

eg: cd /home/user/scriptlocation/; python3.9 /home/user/scriptlocation/script.py

Glad to hear that you made it work!

Can you please elaborate about the cd'ing part, I am facing the same problem while using instabot

You need to cd into the directory that your code is expecting to be the working directory.

hey can you explain the fix in detail . where did you opened your consol ?

Could you clarify exactly what problem you're having? You can open a console from the "Consoles" page inside PythonAnywhere.