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\", line 24, in <module>

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

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

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

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

    return, data, timeout)

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

    response = self._open(req, data)

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

    '_open', req)

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

    result = func(*args)

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

    return self.do_open(httplib.HTTPConnection, req)

  File "C:\Python27\ArcGIS10.2\lib\", 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\", line 88, in urlopen

    return, data)

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

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

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


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


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


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


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

    self.timeout, self.source_address)

  File "C:\Python27\ArcGIS10.2\lib\", 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?