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
  • 4
    A quick search seems to indicate that this can be caused by not specifying the correct working directory. When testing your setup, did you try to invoke the task execution through the task scheduler (there's a Run option for tasks in the library)? – Der Hochstapler Mar 18 '13 at 18:11
  • 1
    Oliver, thanks for the tip, that does sound exactly like what I'm experiencing. I updated the script path to exclude the current working directory, instead specifying it in "Start in". When I run the task nothing visibly happens in the scheduler (I would expect the status to be "Running..."), but eventually it completes. Thanks again! – Rob Mar 18 '13 at 19:33

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.