Select to view content in your preferred language

Error 000005 ("Could not open address locator") with ArcGIS Server Python but not in Pro

2309
5
Jump to solution
05-04-2023 05:16 PM
AllenDailey1
Occasional Contributor III

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:

  • A locator built with the Create Locator tool is the input to the Rebuild Address Locator tool and the reference data for the locator is stored in an enterprise geodatabase or is not accessible."

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!

0 Kudos
1 Solution

Accepted Solutions
AllenDailey1
Occasional Contributor III

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.

View solution in original post

5 Replies
by Anonymous User
Not applicable

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.

 

0 Kudos
AllenDailey1
Occasional Contributor III
Thanks for your reply. So far I am just running the script via Command Prompt by entering the Python exe path and the script file path. I have rebuilt the locators manually by running Pro as the account that I use to run the script in Command Prompt, and that works, so I think the account seems fine.
0 Kudos
AllenDailey1
Occasional Contributor III

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.

PSAQATAR
New Contributor II

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 ?

0 Kudos
AllenDailey1
Occasional Contributor III
Hello, unfortunately I don't have any idea why this would be happening! That is weird that it's only happening with the Arabic one. I hope you can find a solution!
0 Kudos