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:
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 ?
The error line at the end states AttributeError: 'NoneType' object has no attribute 'dataFrames'. Also when that part of the script is running the listDataFrames function looks like it requires a wildcard. I would try to add a wildcard when listing the dataframes in the script e.g.
df = arcpy.mapping.ListDataFrames(mxd, "*")