简体   繁体   English

任务计划程序认为python脚本仍在运行

[英]task scheduler thinks python script is still running

I have a python script which in turn executes other python scripts. 我有一个python脚本,该脚本又执行其他python脚本。 I put this as a task on WinXP task scheduler. 我将此作为任务放在WinXP任务计划程序上。 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 ! 但是Task Scheduler认为任务仍在运行! which in turn prevents it from running it again on daily basis. 反过来又阻止了它每天再次运行。

so I tried making a BAT file which just calls the script: 所以我尝试制作一个仅调用脚本的BAT文件:

script.py
echo pyfinished

to my surprise cannot see 'pyfinished' at the end ... 令我惊讶的是最终看不到“完成” ...

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). 我为确保脚本停止所做的就是将任务配置为在1小时后停止(或脚本应花费多长时间)。 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. 至于为什么Task Scheduler无法检测到脚本已完成,我不知道。 It's royally annoying. 真是令人讨厌。

包含os.system('cmd /K script.py')os.system('cmd /K script.py')该进程保持活动状态,直到我手动将其杀死为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM