Windows scheduled tasks fail with 0x1, don’t log errors

pythonwindows server 2008windows task scheduler

I have three Python scripts running overnight as scheduled tasks on a Windows Server 2008 VM. I can run them manually with no problems. But when I look at the Task Scheduler each morning, the first has run successfully and the subsequent two returned 0x1. I added an exception handler to all three scripts to log the traceback, hoping to find the guilty operation. I tested the handler by manually raising an Exception which was working fine. However, when I checked the next day no log had been created, meaning the script either never ran or didn't actually throw an error. Can anyone shed any light on what exactly 0x1 means, or if there's a situation in which the script would run but still return that?

For what it's worth, this is the batch file that calls the script:

@echo off
"E:\Scripts\Backup\create_backup.py"

Best Answer

Look like this problem outside of python. May be i wrong, but by default windows allow cmd.exe execution only for logged in user. To check, add diagnostic output to cmd script

echo Run %DATE% %TIME% >> c:/tmp/file.log

Related Question