Problem: Windows Task Scheduler will not run a Python script
Python scripts can be run using the Windows Task Scheduler administrative tool, however occasionally these scripts do not work. This article describes the steps to troubleshoot the use of Task Scheduler with Python scripts.
There are several possible causes for this problem, including problems with the script itself, and issues with the Task Scheduler settings or function.
Solution or Workaround
Esri has not created their own task scheduler, thus troubleshooting an installation or workflow with a task scheduling program is not supported.
- Test the script. Check to see if the script is working without Task Scheduler, then check to see if it is working within Task Scheduler:
a. Does the script run independently of Task Scheduler? Verify that the input/output is what is expected, and that the script can run smoothly without the use of Task Scheduler.
b. Once the new task is set up, can it run from the Task Scheduler Library? Right-click a task and select 'Run'. Verify that this executes the script and returns the expected results from step a, above. For more help in setting this up, check the blog mentioned in the Related Information section of this page.
c. Schedule the task to run at a time when it can be checked periodically. Running a scheduled task from beginning to end and checking the output is important. If a task is run overnight, there may be interruptions that are not detectable in the morning.
- If the preceding steps fail, it may be necessary to troubleshoot the Windows Task Scheduler. Try the following steps:
a. Try checking on the option in task scheduler: 'Run with highest privileges'.
b. Right-click the task in the Task Scheduler Library, and select Properties. Find this option in the General tab, select it, and click OK.
c. Try running Task Scheduler as an administrator: Right-click Task Scheduler > Run as Admin.
d. Work with your organization's IT Department to ensure that your Windows User profile has full permissions to run Task Scheduler, and that nothing interferes with this.
- If these steps still do not resolve the issue where the script does not run effectively as a scheduled task, consider using a different task scheduler. Many free task schedulers are available online.
- Schedule geoprocessing scripts in Windows Task Scheduler for Vista
- ArcGIS Blog: Scheduling a Python script or model to run at a prescribed time
- ArcGIS Help: Scheduling a Python script to run at prescribed times