I have a script that uses the Python API to logging into the server, stop geocode services, rebuild locators and start services.
Is there a way to use Windows task scheduler to run this script. I've tried this Schedule a Python Script using Windows Task Scheduler and Run stand-alone scripts without success.
Edited: I'm using Windows task scheduler on our server machine where other python scripts work correctly in the task scheduler.
Solved! Go to Solution.
I was able to add the script to task scheduler using the python.exe file in arcgispro-py-clone folder.
I have a clone folder because I had to install some python packages that are not part of Pro. Pro creates a clone folder when you install additional packages. The location of that folder is C:\Users\(user name)\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone
My bet is you are trying to use Windows Task Scheduler on a desktop machine with windows 10. I've never been able to get Task Scheduler to work in that situation; I've only been successful running scheduled tasks on a dedicated server.
You should be able to. I am doing the exact same thing with Anaconda on my local desktop machine. My Python script does the following.
Jim L.
The script works. What I can't do is make it work in Windows task scheduler to run after hours.
I'm assuming you are leaving your machine on. Try running with the following options enabled:
Do you have your Actions setup correctly?
Hope this helps
Are you running a bat file that calls multiple python scripts or are all the operations done in 1 python script (stop geocode service, rebuild locator, start geocode service)? I currently have the Windows Task Scheduler setup to stop geocode services from a Windows 10 desktop, but it only worked the first time I ran it automatically and now it no longer executes the python script automatically so the rebuild address locator fails since there is still a lock on the address locator from the service that did not get stopped.
I'm using one python script and Pro's propy.bat file per ESRI's documentation here Run stand-alone scripts
I have also tried using the python.exe file in arcgispro-py3 without any success.
There is a reference to a python script in the updated help topic for keeping your locator and geocode service updated with new data https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/keep-your-locator-up-to-date.htm#ESRI_S.... Perhaps try using the Updating Geocoding Services script for the scheduled task.
I was able to add the script to task scheduler using the python.exe file in arcgispro-py-clone folder.
I have a clone folder because I had to install some python packages that are not part of Pro. Pro creates a clone folder when you install additional packages. The location of that folder is C:\Users\(user name)\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone
Alicia, I am trying to do the same thing. I have a working script in Python 2.7 and am trying to convert it to Python 3.7 and having problems. Would you be willing to post your working Python 3 script to stop geocoding service, rebuild locator, and start geocoding service?