AnsweredAssumed Answered

python - manage workspace for dynamic layers

Question asked by Razzino13 on Oct 13, 2014


using python, I would like to manage the publication of a map service with the property of the capabilities Mapping "manage workspace for dynamic layers"


using the following piece of code (highlighted part)


import arcpy

import os.path

import xml.dom.minidom as DOM



arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER', con, True, "FS", summary, tags)


doc = DOM.parse(sddraft)

keys = doc.getElementsByTagName('Key')

for key in keys:


        if == 'enableDynamicLayers': = True


        if == 'dynamicDataWorkspaces': =[{"id":"MyFile_GDBWorkspaceID","workspaceFactory":"FileGDB","workspaceConnection":"database=C:\\PIR\fase230\\PIR_Giugno2014.gdb"}]


        if == 'maxRecordCount': = 5000


services___ = doc.getElementsByTagName('TypeName')

for service__ in services___:

        if == 'KmlServer':

service__.parentNode.getElementsByTagName('Enabled')[0] = 'false'

        if == 'WMSServer':

service__.parentNode.getElementsByTagName('Enabled')[0] = 'true'


# save changes

if os.path.exists(sddraft): os.remove(sddraft)

f = open(sddraft,"w")




        arcpy.StageService_server(sddraft, sd)

arcpy.UploadServiceDefinition_server(sd, con, service, inCluster)


I have the following error:


exceptions.AttributeError: 'NoneType' object has no attribute 'data'               



I think there is an error in the values that pass

Thank you for your help