Error handling and alerts in PythonAnywhere


New subscriber here -- thanks for the service. Forgive me as I'm somewhat new to this world, but what is the best way to handle potential errors through PythonAnywhere?

I have a script running as a scheduled task once an hour, but am worried that if there is an error -- such as if my API request within the script is unsuccessful -- I will not know that it failed unless I continually check for the output of the script.

Is it recommended to do error handling within the python script somehow, such as with logging and maybe even something set up to email me if things go haywire? Or is there a way to do this within PythonAnywhere?

In addition, if my scheduled script does fail once, will this cancel all subsequent scheduled tasks, or will the script still be run next hour?

Thank you.

Thanks for using our system!

Yes, we recommend that you put something in the script to catch errors and send yourself an email if it's critical that you know of any problems with it. (Having some kind of built-in alert to email people when tasks exit with an error is something that people have asked for in the past, and is on our list of suggested enhancements -- I've added an upvote on your behalf so that its priority gets bumped up a bit.)

If the task fails once, it will still be run the next time.

Got it, will do. Thanks for the info!

yeah would be great to have an e-mail notification when always on tasks are invoked, rather than having to implement the SMTP logic into my app.

I upvoted the ticket.

another subscriber here would like to add upvoting for this service as well - we left another host that had mediocre python support but did have good built in cron job alerts on failure - good for us administrators who may not be python coders in charge of implementing someone else's code for a task

No problem. I have upvoted the ticket.

Adding my vote as well. Would be useful! Not critical for me, though I can see how it is for other people. And if it is critical they can build it into the script!

No problem. I have upvoted the ticket.

Not sure how to upvote the ticket, but wondering if anyone has an easy solution to error check

No problem. I have upvoted the ticket.

Please add my up vote on ticket.

No problem. I have upvoted the ticket.