AnsweredAssumed Answered

ListDataFrames failed after publishing as a service

Question asked by tempogis on May 12, 2016
Latest reply on Aug 11, 2016 by rastrauch

I've got a pretty simple script which runs successfully on my local (ArcGIS Desktop), but after i publish it as a service, it throws error when it is being called. The path of the mxd should be globally accessible and the data frame should also be valid in mxd file. So what could the reason of not running as a service? Thanks!!


import arcpy

mapDoc = arcpy.mapping.MapDocument(r"\\server_name\folder_name\test.mxd")                       

dataFrames = arcpy.mapping.ListDataFrames(mapDoc)

dataFrame = dataFrames[0]

dataFrameSR = dataFrame.spatialReference


The error message is


esriJobMessageTypeError: Traceback (most recent call last): File "\\server_name\folder_name\", line 175, in dataFrames = arcpy.mapping.ListDataFrames(mapDoc) File "d:\program files\arcgis\server\arcpy\arcpy\", line 181, in fn_ return fn(*args, **kw) File "d:\program files\arcgis\server\arcpy\arcpy\", line 1479, in ListDataFrames result = mixins.MapDocumentMixin(map_document).listDataFrames(wildcard) File "d:\program files\arcgis\server\arcpy\arcpy\arcobjects\", line 728, in listDataFrames return list(reversed(list(self.dataFrames))) File "d:\program files\arcgis\server\arcpy\arcpy\arcobjects\", line 695, in dataFrames return map(convertArcObjectToPythonObject, self.pageLayout.dataFrames) AttributeError: 'NoneType' object has no attribute 'dataFrames'