Is anyone else having trouble of importing arcgis.gis.server module?

2007
12
02-10-2018 07:26 PM
SpencerHan1
New Contributor II

Following the 1.3 documentation, there is a arcgis.gis.server submodule nested under arcgis.gis. 

However when I try use it, I get an error saying "`arcgis.gis` has no attribute `server`". Souce code as shown below. 

>>> import arcgis

>>> arcgis.gis.server.Server(args)

And as suggested in this post, I tried with importing arcgis.gis. But same error occured. 

>>> from arcgis importgis

>>> gis.server.Server(args)

Any help would be greatly appreciated. 

0 Kudos
12 Replies
PhilLarkin1
Occasional Contributor III

Still getting 'folders' key error at v1.3.0

0 Kudos
PhilLarkin1
Occasional Contributor III
from arcgis.gis import server
url = r"https://<server>.<domain>.org:6443/arcgis/admin/
site = server.Server(url,username="<usr>",password="<pw>")
srvdir = site.content
#Will return a MapImage layer
queries = srvdir.get("<name>",folder="<folder>")

srvdir = server.ServicesDirectory(url,username="<usr>",password="<pw>")
#returns error
srvdir.get("<name>",folder="<folder>")
...
KeyError: 'folders'

I suppose i'll try to upgrade to 1.4...

0 Kudos
PhilLarkin1
Occasional Contributor III

For anyone trying to get at the service object, this worked for me at 1.4:

from arcgis.gis import server
url = r"https://<server>.spokanecounty.org:<port>/arcgis/admin/"
site = server.Server(url,username="<usr>",password="<pw>")
admin = site.content.admin adminServices = admin.services
servicelist = adminServices.list(folder="<folderName>")
for x in servicelist:
print(x.statistics)