Hanan
Hanan

Reputation: 1445

task scheduler thinks python script is still running

I have a python script which in turn executes other python scripts. I put this as a task on WinXP task scheduler. the thing runs - command prompt is opened, sparks are flying, magic happens... eventually the task is completed, I get a nice 'print script ended!!' and back to prompt. but Task Scheduler thinks the task is still running ! which in turn prevents it from running it again on daily basis.

so I tried making a BAT file which just calls the script:

script.py
echo pyfinished

to my surprise cannot see 'pyfinished' at the end ...

Upvotes: 2

Views: 2687

Answers (2)

user1070061
user1070061

Reputation: 503

I have this problem as well. What I did to make sure the script stops is configure the task to stop after 1 hour (or however long the script(s) should take). This kills the task and thus when the task schedule comes around again, it has no problem kicking off.

As for why Task Scheduler can't detect the script is finished, I have no idea. It's royally annoying.

Upvotes: 2

Hanan
Hanan

Reputation: 1445

a line with os.system('cmd /K script.py') makes the process stay alive until I manually kill it.

Upvotes: 0

Related Questions