Updating a Arc script to work with 10.3... help appreciated

المشرف العام

Administrator
طاقم الإدارة
new to StackExchange,

I've got a geoprocessing script, that I need to move to a new server. However, this was created a few years ago and I wasn't the one who made it, so I've run into some problems.

This is the script:

## Script to export map from #### Flex Viewer s #### _ #### For Natl Template ##import arcpyimport osimport uuidtemplatePath = r"(computerpath)"Web_Map_as_JSON = arcpy.GetParameterAsText(0)Format = arcpy.GetParameterAsText(1)if Format == '#' or not Format: Format = "PDF" Layout_Template = arcpy.GetParameterAsText(2)if Layout_Template == '#' or not Layout_Template: Layout_Template = "8x11 Landscape" templateMxd = os.path.join(templatePath, Layout_Template + '.mxd')# Connect as __________ for _____ Cloud servicesdictCreds = {"SERVER_CONNECTION_FILE":r"(location of connection file)"}result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd, extra_conversion_options=dictCreds)mxd = result.mapDocumentlegend = arcpy.mapping.ListLayoutElements(mxd, "LEGEND_ELEMENT", "Legend")[0]df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df): if "Labels" in lyr.name: #Find layers that have the word 'labels' in the layer name to remove them from the legend removeLyr = lyr legend.removeItem(removeLyr)output = 'WebMap_{}.{}'.format(str(uuid.uuid1()), Format)Output_File = os.path.join(arcpy.env.scratchFolder, output)if Format.lower() == 'pdf': arcpy.mapping.ExportToPDF(mxd, Output_File, resolution=400) elif Format.lower() == 'png': arcpy.mapping.ExportToPNG(mxd, Output_File)elif Format.lower() == 'jpg': arcpy.mapping.ExportToJPEG(mxd, Output_File)arcpy.SetParameterAsText(3, Output_File)filePath = mxd.filePathdel mxd, resultos.remove(filePath)So, as you can see, this script pulls a connection file to authenticate. I tried to change the parameters around and create a new connection file for the new server, but then when I tried to publish the geoprocessing script, it gave me a "00178" code error, since the publisher was trying to publish the .ags connection to the server. Not sure why it was trying to do that, or how to get around that, but it seems to me that this script is a bit outdated. So I guess to boil down my question, what am I doing wrong in trying to update this script to a new server as a new geoprocessing service? Are there alternatives?



أكثر...
 
أعلى