|
POST
|
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!
... View more
05-04-2023
05:16 PM
|
0
|
9
|
7249
|
|
POST
|
Update - I figured it out. I submitted a help request to Esri, and they tested my code and it worked in their environment. So then I tried to drill deeper into possible issues other than the code itself. I eventually discovered that on our DMZ servers, the account that is running the script (i.e. the account being used to run software like IDLE, Command Prompt, Pro, etc.) has to be the account that enters the credentials - used as an argument for the Server object - into Windows Credential Manager. We are using Keyring to get the credentials from Windows Credential Manager in order to avoid hard-coding them in the script, which would be a security risk. The account I need to use to run the script is different from the account whose credentials have to be passed into the Server object. I ran Command Prompt as the account used to run the script, and in Command Prompt I used Python keyring to set_password for the credentials to be called in the Server object. It seems that in our server environment, an account cannot access credentials that someone else (a different account) entered into Windows Credential Manager. Now the script is able to stop and start services! This issue will probably only apply to a miniscule number of people out there, but it would be cool if this could help at least one other person!
... View more
02-22-2023
11:21 AM
|
1
|
0
|
2787
|
|
POST
|
Thank you for your reply! I believe that the GIS object cannot be used with standalone servers, only the Server object can. But I really appreciate your reply.
... View more
02-22-2023
11:13 AM
|
0
|
0
|
2788
|
|
POST
|
I am working on a standalone script that is supposed to stop a few geocoding services, then rebuild the address locators used in those services, then start the geocoding services. It is supposed to run on a standalone, non-federated ArcGIS Server (version 10.9.1) (the same server that the services were published to) in a DMZ server network. The script is running on the server itself because machines on my internal network cannot connect with the DMZ server in the ways that are needed for this script. I am using the ArcGIS API for Python to stop and start the services, and I based those parts of the script on sample code from Esri. The geocoding services were published on the ArcMap runtime, and today I created a Pro runtime geocoding service, and the script didn't stop that service either. I am running the script in Command Prompt and sometimes in IDLE. PROBLEM: The script does not stop the geocoding services, yet it moves through that part of the script without throwing an error. I can see in Server Manager online that the services are never stopped. It only hits an error when it tries to rebuild an address locator but can't do it because the geocoding service was not actually stopped first. I have run out of ideas of how to troubleshoot or fix this. I have double-checked everything I can think of to check - credentials, names and paths, etc. The credentials being used can indeed stop the services manually in Server Manager. Does anyone have any ideas? Here is the core of the code: import sys
import datetime
from arcgis.gis.server import Server # ArcGIS API for Python
import arcpy
import keyring
if __name__ == "__main__":
# Folder path where the locator is, not the service:
arcpy.env.workspace = r'D:\RootFolder\OtherFolder'
# Name of folder in the Server Manager where the locator lives:
folder_folder_name = 'MyFolder' # File Explorer folder name
ags_folder_name = 'MY_FOLDER' # ArcGIS Server Manager folder name
# Base URL of the ArcGIS Server where the service lives:
server_base_url = r'https://myserverbaseurl:port'
# Names of the locators (not services):
locator_name_list = ['LOCATOR_ROAD', 'LOCATOR_POINTS', 'LOCATOR_ADDR']
# Names of the geocoding services published to the server:
locservice1 = 'MY_FAV_SERVICE'
locservice2 = 'THE_OTHER_SERVICE'
username = keyring.get_password('name', 'user')
pw = keyring.get_password('other_name', 'password')
# Create an instance of a Server object in ArcGIS API for Python.
server = Server(url='{}/arcgis/admin'.format(server_base_url), username=username, password=pw)
# Access server content (ArcGIS API for Python)
cdir = server.content
# Instantiate the services as service objects
service1 = cdir.get(locservice1, folder=ags_folder_name)
service2 = cdir.get(locservice2, folder=ags_folder_name)
# TEST - this worked.
#print(service1.service.iteminformation)
#print(cdir) # This worked.
# Stop the geocoding services in order to next rebuild the locators
service1.service.stop()
service2.service.stop()
# Rebuild the locators.
for locator_name in locator_name_list:
print(locator_name)
arcpy.geocoding.RebuildAddressLocator(locator_name)
# Start the services after rebuilding. (ArcGIS API for Python)
service1.service.start()
service2.service.start()
... View more
01-25-2023
06:10 PM
|
1
|
3
|
2931
|
|
POST
|
Thank you so much! Whoops, it had not occurred to me to do something like that. It worked!
... View more
01-25-2023
12:37 PM
|
0
|
0
|
4418
|
|
POST
|
Please help... I have done so many google searches for this and... nothing. Whyyyy? What is the file/directory location or path of the ArcGIS API for Python, particularly on an ArcGIS Server? I am having extremely mysterious failure with a standalone script that is trying to use the API to stop services, so I want to find some way to check if the API really exists on this server where I'm running the script. Thank you!
... View more
01-25-2023
11:24 AM
|
0
|
4
|
4458
|
|
POST
|
I think I figured it out. I haven't 100% tested this yet, but I believe the error resulted from the .aprx being Pro 3.0 while the machine I was running my script on had Pro 2.7, so it could not open or use the .aprx. I am going to upgrade that machine to Pro 3.0 sometime this week. Update: it worked!
... View more
01-23-2023
04:17 PM
|
2
|
2
|
10297
|
|
POST
|
I'm having the same error, but with my .aprx path, not with a toolbox path. Have any of you been able to solve the problem? Thanks!
... View more
01-23-2023
11:16 AM
|
0
|
3
|
10299
|
|
POST
|
Hi Adrian, Thanks for your reply! It turns out that my survey's problem was actually due to a server being attacked by bots and timing out. Good luck! Allen
... View more
01-03-2022
02:15 PM
|
0
|
0
|
9273
|
|
POST
|
Hi @AdrianDoss , Did you ever resolve this error? I am currently facing the same problem. Thanks! Allen
... View more
12-28-2021
05:26 PM
|
0
|
2
|
9304
|
|
BLOG
|
@IanGallo No, unfortunately I didn't pursue it a lot farther and didn't find a way to do it. Yes, I think we are talking about the same thing. If you find a way to do it, let me know! 🙂
... View more
11-16-2021
02:23 PM
|
1
|
0
|
14115
|
|
POST
|
To answer your question, I use a concurrent use license, Standard license, with no special extensions unless I need them for a specific task. My problem (described in the original post) was because I had not connected to my organization's licensing in ArcGIS Pro. Whoops. So I was attempting to use Pro without any license.
... View more
09-28-2021
02:10 PM
|
0
|
0
|
10874
|
|
POST
|
Thank you, Jonathan! I appreciate your reply. I don't really know anything about requests and scripting internet-related things (someone else wrote the scripts that I have to work with), so I don't yet understand what those sources are talking about, but I will keep doing research and learning. You have given me a helpful starting place, with those links and your reply. Thank you!!
... View more
09-23-2021
01:23 PM
|
0
|
0
|
1764
|
|
POST
|
Hello, I have done lots of searching about this but have not found anything in Esri documentation or here in the Community, so I thought I'd see if anyone can help. My organization is in the midst of a server migration. In our old ArcGIS Server environment, we had token authentication, but in the new one, we have web-tier authentication. I am trying to migrate a Python script that rebuilt an address locator in the old environment; the script includes stopping and then starting services, which is necessary for rebuilding the address locator. I have 2 main problems: The first problem is that I have no idea how to write Python for web-tier authentication, instead of tokens. I have researched this but haven't found anything. Any suggestions? The second problem is that it sounds like it's not possible to stop/start services via a script anymore, at least not as simply as in the past (see: https://community.esri.com/t5/arcgis-enterprise-questions/start-stop-secure-services-in-10-6-1/td-p/646090 ). I saw that it is possible to do it with the ArcGIS API for Python, but that it requires that the server be federated (https://support.esri.com/en/technical-article/000019994 ). The involved servers are not federated, unfortunately, but we have other servers that are federated. Does anyone know how to stop/start services in a script, services that are not on a federated server? Thanks so much! Allen
... View more
09-14-2021
12:16 PM
|
1
|
2
|
1857
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 2 | 2 weeks ago | |
| 1 | 09-17-2020 12:57 PM | |
| 1 | 3 weeks ago | |
| 3 | 09-30-2025 05:49 PM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|