Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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"
share|improve this question
2  
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)? –  Oliver Salzburg Mar 18 '13 at 18:11
    
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! –  Jura Mar 18 '13 at 19:33
add comment

2 Answers

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

share|improve this answer
add comment

I set up WinSCP and scheduled tasks a lot and I have learned that result "0x1" means exactly nothing. At best, you know that the task did not return a verbose error or it did not return a "task completed successfully" output. That leaves every other possibility, ever.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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