Hey all, running into an issue where I can rebuild a locator in Pro running the gp tool Rebuild Address Locator, but if I try to rebuild it in a script using arcpy, it doesn't work. I get 'Error 000005: Could not open the address locator' .
The rest of the code in my script publishing the locator and sharing it works fine, I just cant rebuild it. The execution block for this part of the script is about as simple as it can be as arcpy.geocoding.RebuildAddressLocator only has one argument, the locator path.
try:
arcpy.geocoding.RebuildAddressLocator(locator_path)
print("The geocoder was rebuilt successfully")
except arcpy.ExecuteError:
print("Error rebuilding")
print(arcpy.GetMessages(2))
I found this post - https://community.esri.com/t5/python-questions/error-000005-quot-could-not-open-address-locator/td-p...
But I am already running this script on the same server where we do a lot of our Pro work, and always have Pro open and signed into both AGOL and our Portal. Doesn't seem to be a pathing or environment issue as publishing works fine.
Is this a bug or am I missing something? Thanks,
You're doing everything exactly like for the docs say, I don't think it's anything with how your wrote your business logic, but probably something with permissions. It seems like that function just raises a generic error when it fail to authenticate.
Thanks for looking. I'm not sure what else to try, there are no other variables to test with. I've re-created it several times manually but that hasn't fixed the issue. And in the script I am signing into both arcgis online and portal in order to publish the service definition, and share the locator publicly. So I'm pretty stumped!
check if you are using the correct path of python executable... python 3 not python 2.
@AaronManuel2 Did you ever sort this out? We are completely stumped by the same issue....
Hello, I did find a workaround. I changed my script to rebuild from local reference data, in a file geodatabase, instead of referencing data from our db or server and for some reason it works. So now I have a job on our server machine that exports our address data into this file gdb before the rebuild script runs so its using the latest data.
This has to be a bug or incompatibility issue of some kind, though our backend configuration is not out of the ordinary. I haven't tested it recently to see if it will work pointed to server/db now, but my script is still working with the local data so I'm just leaving it at that. Hope this helps.
Oh, interesting... Yes, that is helpful. It kind of sounds like there is some sort of permission issue. Either ArcGIS Pro or database connection user. At this point, I'm just going to open a case and dive into it with ESRI.
Thanks!