I am trying to automate rebuilding address locators with a Python script.
I am able to successfully rebuild the address locators manually in ArcGIS Pro with the Rebuild Address Locator geoprocessing tool.
But I continually get "Error 000005: Could not open the address locator" when trying to rebuild them with the script. I've run out of ideas of things to check.
In the documentation for Error 000005, it says:
"This error can occur for one of the following reasons:
Does this mean that, if you use those tools, the locator cannot use data from an enterprise geodatabase? It would be super helpful if someone could confirm that for me. I feel like that is what the documentation says, but I just find that hard to believe, because it seems like most people would be using data from an enterprise gdb!! I am.
Here are the relevant parts of my script - can you see anything that should be changed??
import arcpy
arcpy.env.workspace = r'D:\MyFolder\Locators'
arcpy.geocoding.RebuildAddressLocator(r"D:\MyFolder\Locators\MY_LOCATOR")
# I also tried the above line with only the locator name as the argument ("MY_LOCATOR")
Thank you!
Solved! Go to Solution.
I got an answer! I worked with Esri representatives and it took some time and digging, but they ultimately told me that you need to be connected to the Esri License Manager, like via ArcGIS Pro on the machine, in order to use geoprocessing tools like Rebuild Address Locator in Python. This explains why I was able to run the function in a Pro Notebook, and then later in Windows Command Prompt using the Python .exe that comes with Pro, but not the Python .exe that comes with ArcGIS Server. Side note - I was trying to run the script on an actual ArcGIS Server, rather than a PC or file server, because we needed to rebuild our address locators that are in our Public DMZ network. Internal network machines cannot access the DMZ servers for this purpose, so I was trying to run the script on the DMZ server using the Python .exe that comes with ArcGIS Server software (because Pro was not installed on that server, and regardless, that server can't access the license manager in order for Pro to work there).
So the solution is to have Pro on the machine and connect to the license manager. If the machine cannot do that, which is the case for our DMZ servers, then you have to find a workaround. We might try rebuilding the locators on the internal network and then copying the files onto the DMZ server, or allowing the ability to have a shared folder on the DMZ server where the internal server can access the locator files.
Esri previously told me that Server Python and Pro Python were equivalent, and I'm sure they have the same ingredients, but it would be nice if there was documentation somewhere that said you basically can't use arcpy via Server Python.
When you run the script, is it in task scheduler or through an IDE? I'd look at the connection that is being used to access the features in the sde and see if the user you are running the script under has adequate permissions. We source data from the sde as well, but do not have that issue with 000005's.
I got an answer! I worked with Esri representatives and it took some time and digging, but they ultimately told me that you need to be connected to the Esri License Manager, like via ArcGIS Pro on the machine, in order to use geoprocessing tools like Rebuild Address Locator in Python. This explains why I was able to run the function in a Pro Notebook, and then later in Windows Command Prompt using the Python .exe that comes with Pro, but not the Python .exe that comes with ArcGIS Server. Side note - I was trying to run the script on an actual ArcGIS Server, rather than a PC or file server, because we needed to rebuild our address locators that are in our Public DMZ network. Internal network machines cannot access the DMZ servers for this purpose, so I was trying to run the script on the DMZ server using the Python .exe that comes with ArcGIS Server software (because Pro was not installed on that server, and regardless, that server can't access the license manager in order for Pro to work there).
So the solution is to have Pro on the machine and connect to the license manager. If the machine cannot do that, which is the case for our DMZ servers, then you have to find a workaround. We might try rebuilding the locators on the internal network and then copying the files onto the DMZ server, or allowing the ability to have a shared folder on the DMZ server where the internal server can access the locator files.
Esri previously told me that Server Python and Pro Python were equivalent, and I'm sure they have the same ingredients, but it would be nice if there was documentation somewhere that said you basically can't use arcpy via Server Python.
I have am getting a similar error code when i try to Rebuild my Locator but in my case, I am using a File Geodatabase. I have 2 Locators actually, one for English and the other for Arabic Search. Reference data is the same. Surprisingly, the English Locator succeeded in Rebuilding while the Arabic Locator Fails. I am just running it in Pro which is connected to a ArcGIS LM. but will eventually put into a code and run in as a Task in Task Scheduler. Any ideas ?