简体   繁体   English

通过Windows 7 Scheduler的python脚本仍在运行

[英]python script via windows 7 scheduler still running

I'm a noobie to python and have over the past few days tested and created a .PY file that runs perfectly from the command prompt either with the D:\\Python34 or just as Its pretty basic. 我是python的新手,并且在过去几天中进行了测试,并创建了一个.PY文件,该文件可以在命令提示符下使用D:\\ Python34或完全像它的基本代码一样完美运行。 Gets info from web and places it in a spreadsheet - I import requests, BeautifulSoup and openpyxl. 从网络获取信息并将其放置在电子表格中-我导入请求,BeautifulSoup和openpyxl。 The last statement is to save the workbook. 最后一条语句是保存工作簿。 I'm figuring that Python closes itself as does the workbook. 我认为Python和工作簿一样会自行关闭。

I wish to run it daily. 我希望每天运行一次。 So I used the Windows Task Scheduler on my Windows 7 Ultimate. 因此,我在Windows 7 Ultimate上使用了Windows Task Scheduler。 I have it running only when I am logged in. I have tried the following: 1) using python directly with complete paths 2) using only the full path and the 3) using a batch file that does #1 above and has an EXIT 4) using a batch file that does #2 above and has an EXIT 我只有在登录时才运行它。我尝试了以下操作:1)直接使用具有完整路径的python 2)仅使用完整路径和3)使用执行上述#1并具有EXIT 4的批处理文件)使用执行上述#2且具有EXIT的批处理文件

When running the batch from the command file OR Task Scheduler, the command window opens, it does its thing and the command window closes. 从命令文件或任务计划程序运行批处理时,命令窗口将打开,它会执行相应的操作,并且命令窗口会关闭。

The problem is when I run it via the Task Scheduler in any of the above ways, it does its thing, but continues to say "RUNNING" in the scheduler. 问题是,当我以上述任何一种方式通过任务计划程序运行它时,它确实起作用,但是在计划程序中继续说“正在运行”。

I have tried to run the Windows Process Monitor using some filters I found on the web, however nothing shows up. 我试图使用一些在网上找到的过滤器来运行Windows Process Monitor,但是没有任何显示。

Extremely frustrating --Any suggestions would be appreciated. 非常令人沮丧-任何建议将不胜感激。 Jerry 杰瑞

While I had the Task Scheduler open, the screen was showing "running". 当我打开任务计划程序时,屏幕显示“正在运行”。 After I closed the screen and let it run the next day, everything worked fine. 关闭屏幕并让第二天运行后,一切正常。 It must be something to do with the refresh on the task scheduler. 这必须与任务计划程序上的刷新有关。

So my solution was to close the Task Scheduler and let it run as scheduled. 因此,我的解决方案是关闭任务计划程序,并使其按计划运行。

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

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