Reputation: 133
I have a python script. I have scheduled it to run monthly on Windows scheduler. However, it is prone to error sometimes and I would like to know if it threw an error. However the windows scheduler always shows the status as Successful. How can I make the Windows scheduler display the error or notify me if my .py script throws an error?
Upvotes: 0
Views: 2122
Reputation: 16952
I don't believe you can show the information in Windows scheduler because it calls ShellExecuteEx()
to run your program and that will report success no matter what return code your Python program issues. That is because the scheduler has successfully run the Python interpreter, which is all it cares about.
Have your program write the error to the Windows event log and look for it there. You can get fancy and set up the event log to notify you.
Upvotes: 1