Select to view content in your preferred language

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

4456
8
Jump to solution
05-04-2023 05:16 PM
AllenDailey1
Frequent Contributor

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
Frequent Contributor

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

8 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
Frequent Contributor
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
Frequent Contributor

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.

AlcoGISUser
Emerging Contributor

This is really annoying. I published a locator to portal and then created a geoprocessing tool that use the locator. Tool works great in Pro but I get the 000005 error too when running it as a geoprocessing tool on Portal. So then, is it because Python, ArcPy, are being run on server when I try to use the geoprocessing tool on portal? Why ESRI? WHY!!??

0 Kudos
geopamplona
Emerging Contributor

Hi @AllenDailey1 ,

I'm in a similar situation to yours: I try to run RebuildAddressLocator from python and I get the same error ‘Error 000005: Could not open the address locator’.

Maybe my case is a bit simpler but maybe you could help me.
I have tried to create the locator from arcgis pro 2.9.5, I generate the loc and loz files, and I try to rebuild the locator, everything works correctly; but if I close arcgis pro and open it again I can't rebuild the locator and I get the error you mentioned.

The locator source is a feature layer hosted in an enterprise sqlserver database with no locks, as it is a layer that is not published as a service, and with versioning.

I work under a version arcgis pro 2.9.5 and always logged against portal 10.9.1.

I have installed the license manager on the machine I run from but I haven't changed anything.

The idea would be to go ahead and launch this from python as you do to schedule it weekly but I can't get out of this simple point.

Thank you!

 

0 Kudos
AllenDailey1
Frequent Contributor

Hi there,

I'm sorry you're having this problem, and sorry to say I have no idea why this would be happening!  Perhaps Esri Support could help troubleshoot it with you?  Good luck!

Allen

0 Kudos
PSAQATAR
Emerging Contributor

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
Frequent Contributor
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