任务调度程序认为 python 脚本仍在运行 [英] task scheduler thinks python script is still running

查看:60
本文介绍了任务调度程序认为 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.

这篇关于任务调度程序认为 python 脚本仍在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆