简体   繁体   English

从任务计划程序 (Windows 10) 执行 python 脚本时出现 0x1 错误

[英]0x1 error on python script execution from Task Scheduler (Windows 10)

I am trying to run script ( script1.py ) from windows task scheduler .我正在尝试从windows task scheduler运行脚本 ( script1.py )。 The script is supposed to control Chrome webdriver and I believe it could be the root of the problem.该脚本应该控制 Chrome webdriver ,我相信它可能是问题的根源。

Result is 0x1.结果是 0x1。

Before creating the task I tested the execution of script1.py directly from cmd and it works.在创建任务之前,我直接从cmd测试了script1.py的执行并且它工作正常。

So I've created script which writes into the file in the same location as script1.py , than created task - 0x0 , record is added to the file.所以我创建了脚本,该脚本在与script1.py相同的位置写入文件,而不是创建任务 - 0x0 ,记录被添加到文件中。

works:作品:

<Exec>
    <Command>C:\Windows\System32\cmd.exe</Command>
    <Arguments>/c C:\Users\MyUser\Anaconda3\python.exe d:\folder\write_dummy_file.py</Arguments>
</Exec>

Doesn't work:不起作用:

<Exec>
    <Command>C:\Windows\System32\cmd.exe</Command>
    <Arguments>/c C:\Users\MyUser\Anaconda3\python.exe d:\folder\script1.py</Arguments>
</Exec>

The task to run write_dummy_file.py was created from xml file of the task to run script1.py .运行write_dummy_file.py的任务是从运行script1.py的任务的xml文件中创建的。

Those are modules used in the problem script1这些是问题脚本中使用的模块1

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from datetime import datetime
import time
import win32com.client as comclt
import pickledb

Update 1:更新 1:

Apparently I was sleepy when asked this.当被问到这个时,显然我很困。 In the logs I see "Action started", "Action completed", "Task completed".在日志中,我看到“操作已开始”、“操作已完成”、“任务已完成”。 In the Task Manager I can see multiple instances of the Chromedriver, but expected job is not done - browser was never opened在任务管理器中,我可以看到 Chromedriver 的多个实例,但没有完成预期的工作 - 浏览器从未打开

Since we deal with webdriver in the script, the execution should be visible.由于我们在脚本中处理 webdriver,因此执行应该是可见的。 Task has to be set for " Run only when user is logged in ", otherwise it ran in background and failed (it was set to "Run whether user is logged on or not").任务必须设置为“仅在用户登录时运行”,否则它会在后台运行并失败(它被设置为“无论用户是否登录都运行”)。

I had the same problem, but I searched all kinds of ways on Google that were unsuccessful.我也遇到了同样的问题,但是我在谷歌上搜索了各种方法都没有成功。 Finally, I found that the reason for the execution failure was that my py script had a third-party library that was not installed in Python (the script worked well in spyder, but "DLL load failed" in python.exe)hoping to help people in similar situations最后发现执行失败的原因是我的py脚本有第三方库没有安装在Python中(脚本在spyder中运行良好,但是python.exe中“DLL加载失败”)希望能帮到你处于类似情况的人

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

相关问题 Python - 任务计划程序 0x1 - Python - Task Scheduler 0x1 Python 脚本 Windows 任务调度程序 - Python Script Windows Task Scheduler Windows 任务计划程序无法运行 Python 脚本,错误值:2147944320 - Windows Task Scheduler unable to run Python Script, error value: 2147944320 Python 脚本未在 Windows 任务计划程序中运行 - Python script not running in Windows Task Scheduler Windows Task Scheduler终止python脚本,操作码2 - Windows task scheduler terminates python script, opcode 2 Windows 任务计划程序,python 脚本,代码 2147942401 - Windows Task Scheduler, python script, code 2147942401 从任务调度程序运行 python 脚本作为任务 - Running a python script as task from task scheduler 为什么Windows 10 Task Scheduler执行我的Python脚本时会产生不同的运行 - Why does my Python script run differently when executed by Windows 10 Task Scheduler 在 Windows 任务计划程序上运行 python 脚本时如何修复“上次运行结果 (0x2331)”? - How to fix "last run result (0x2331)" when running a python script on Windows Task Scheduler? 在 python 中运行复制文件脚本 27 在 Windows 任务计划程序中获取路径错误 errno22 - run copy file script in python 27 get path error errno22 in Windows Task Scheduler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM