我有一个批处理文件,它运行一个python文件,通过一个html文件中的Plotly输出一个交互式图。通过双击运行文件运行得很好,但是当通过Windows调度程序运行时,它不起作用。
Python代码生成plotly html:
plot(fig,filename='output.html')
运行python文件的批处理文件:
python file.py
双击批处理文件可以正常工作。通过Window的Scheduler运行批处理文件不起作用,并在命令提示符中输出以下错误:
Traceback (most recent call last):
File "C:\~\file.py", line 224, in <module> plot(fig,filename='output.html')
File "C:\ProgramData\Anaconda3\lib\site-packages\plotly\offline\offline.py", line 721, in plot with open(filename, 'w') as f:
PermissionError: [Errno 13] Permission denied: 'output.html'
知道为什么这不能通过Windows Scheduler工作吗?
弄清楚了。
我没有将任务计划程序中的任务设置为“以最高权限运行”。检查该框是否解决了问题。