Hello! I'm having an issue with a GP service that runs a Python script. The script works fine in ArcGIS toolbox, but it fails when I run it as a GP Service. Is failing when tries to list the dataframes of the mxd in this line df = arcpy.mapping.ListDataFrames(mxd)
part of the script that fails:
TemplateMXD = r"\\kl-fs-003\GIS_Storage\Ancillary\Templates\Map_Document_Templates\Task_Based\Land_Registry_SketchUp_DrawingTemplate.mxd"
mxd = arcpy.mapping.MapDocument(TemplateMXD)
df = arcpy.mapping.ListDataFrames(mxd)
The exception is:
- esriJobMessageTypeError: Traceback (most recent call last): File "D:\arcgissystem\arcgisinput\UK_I\ExportPropertySketchToShapefilePDF.GPServer\extracted\v101\afernandez\Land_Registry_SkectchUp_2016.py", line 170, in df = arcpy.mapping.ListDataFrames(mxd) File "c:\program files\arcgis\server\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "c:\program files\arcgis\server\arcpy\arcpy\mapping.py", line 1479, in ListDataFrames result = mixins.MapDocumentMixin(map_document).listDataFrames(wildcard) File "c:\program files\arcgis\server\arcpy\arcpy\arcobjects\mixins.py", line 728, in listDataFrames return list(reversed(list(self.dataFrames)))
- File "c:\program files\arcgis\server\arcpy\arcpy\arcobjects\mixins.py",
- line 695, in dataFrames return map(convertArcObjectToPythonObject, self.pageLayout.dataFrames)
- AttributeError: 'NoneType' object has no attribute 'dataFrames'
For some reason seems that the GP service is not able to open the mxd correctly. TemplateMXD is a UNC path and this path is Accessible to ArcGIS Server (in ArcGIS Server Manage, I've added \\kl-fs-003\GIS_Storage\ as a Registered Folder) (see attached).
The mxd is fine, and the layer that contains the mxd is correct, there is no problems or broken links in there.
Any ideas of what could be wrong ?