任务调度程序认为 python 脚本仍在运行
我有一个 python 脚本,它依次执行其他 python 脚本.我把它作为 WinXP 任务调度程序的一个任务.事情运行 - 命令提示符被打开,火花飞扬,魔法发生......最终任务完成,我得到了一个很好的'打印脚本结束!!'并返回提示.但是任务计划程序认为任务仍在运行!这反过来又会阻止它每天再次运行它.
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.
所以我尝试制作一个只调用脚本的 BAT 文件:
so I tried making a BAT file which just calls the script:
script.py
echo pyfinished
令我惊讶的是,最后看不到 'pyfinished' ...
to my surprise cannot see 'pyfinished' at the end ...
我也有这个问题.我为确保脚本停止所做的是将任务配置为在 1 小时后停止(或脚本需要多长时间).这会终止任务,因此当任务计划再次出现时,启动就没有问题了.
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.
至于为什么Task Scheduler检测不到脚本完成,我不知道.这真是令人讨厌.
As for why Task Scheduler can't detect the script is finished, I have no idea. It's royally annoying.