AnsweredAssumed Answered

error deleting map service with Python/ServerAdmin API - Arc Server 10.2

Question asked by deleted-user-ugCMpXci8bn5 on Mar 2, 2015

I am trying to delete a map service on ArcGIS 10.2 for Server using Python 2.7 and the ArcGIS for Server Administrator API as shown in this example:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

 

I have not yet been able to successfully run this script.  I have tried with and without a token.

 

Below is the traceback in IDLE when I try the example code with a token:

 

Traceback (most recent call last):

  File "C:\Users\me\Desktop\deleteServices.py", line 24, in <module>

    deleteservice("myserver", "my map service", None, None, 'token_string')

  File "C:\Users\me\Desktop\deleteServices.py", line 18, in deleteservice

    urllib2.urlopen(delete_service_url, ' ').read() # The ' ' forces POST

  File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 126, in urlopen

    return _opener.open(url, data, timeout)

  File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 400, in open

    response = self._open(req, data)

  File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 418, in _open

    '_open', req)

  File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 378, in _call_chain

    result = func(*args)

  File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 1207, in http_open

    return self.do_open(httplib.HTTPConnection, req)

  File "C:\Python27\ArcGIS10.2\lib\urllib2.py", line 1177, in do_open

    raise URLError(err)

URLError: <urlopen error [Errno 11004] getaddrinfo failed>

 

..and here is the traceback when I run the same code without a token:

........

.......

  File "C:\Python27\ArcGIS10.2\lib\urllib.py", line 88, in urlopen

    return opener.open(url, data)

  File "C:\Python27\ArcGIS10.2\lib\urllib.py", line 209, in open

    return getattr(self, name)(url, data)

  File "C:\Python27\ArcGIS10.2\lib\urllib.py", line 344, in open_http

    h.endheaders(data)

  File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 954, in endheaders

    self._send_output(message_body)

  File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 814, in _send_output

    self.send(msg)

  File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 776, in send

    self.connect()

  File "C:\Python27\ArcGIS10.2\lib\httplib.py", line 757, in connect

    self.timeout, self.source_address)

  File "C:\Python27\ArcGIS10.2\lib\socket.py", line 553, in create_connection

    for res in getaddrinfo(host, port, 0, SOCK_STREAM):

IOError: [Errno socket error] [Errno 11004] getaddrinfo failed

 

 

I have been able to run ArcPy functions to create and start map services on this server successfully.

Has anyone successfully used this example code?

Outcomes