我正在尝试使用任务计划程序运行python脚本,我已经编写了一个批处理文件;
"C:\Program Files\WinPython64\python-3.7.7.amd64\python.exe" "C:\Users\USER\Documents\Python_Code\python3.6\Web_Scraping\Firmware_Upgrade\Set_Check_Upgrade_v7.py"
其中的一个简单的Hello World类型示例。
C:\Windows\system32>"C:\Program Files\WinPython64\python-3.7.7.amd64\python.exe" "C:\Users\USER\Documents\Python_Code\python3.6\Web_Scraping\Firmware_Upgrade\Set_Check_Upgrade_v7.py"
DevTools listening on ws://127.0.0.1:53073/devtools/browser/18cef93b-eaa4-4e14-9439-6f0b66b60727
Traceback (most recent call last):
File "C:\Users\USER\Documents\Python_Code\python3.6\Web_Scraping\Firmware_Upgrade\Set_Check_Upgrade_v7.py",line 22,in <module>
firmware_data = pd.read_excel(total_string)
File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\io\excel\_base.py",line 304,in read_excel
io = ExcelFile(io,engine=engine)
File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\io\excel\_base.py",line 824,in __init__
self._reader = self._engines[engine](self._io)
File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\io\excel\_xlrd.py",line 21,in __init__
super().__init__(filepath_or_buffer)
File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\io\excel\_base.py",line 353,in __init__
self.book = self.load_workbook(filepath_or_buffer)
File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\io\excel\_xlrd.py",line 36,in load_workbook
return open_workbook(filepath_or_buffer)
File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\xlrd\__init__.py",line 111,in open_workbook
with open(filename,"rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'Upgrade_v5.22_01-08-2020.xlsx'
我使用的python代码是
file_string = 'Upgrade_v5.22_01-08-2020'
total_string = file_string + '.xlsx'
firmware_data = pd.read_excel(total_string)
在Pycharms IDE中运行但不使用Windows 10 Task Scheduler App时可以使用。
我尝试创建启用了“以最高特权运行”的任务,但这没什么区别。