Assertion Error with arcpy.mapping.UpdateLayer

المشرف العام

Administrator
طاقم الإدارة
I"m working with arcpy, where I'd like to write a script that examines the selection and if only 1 element is selected creates a buffer. I want to get the symbology from another layer, as the buffer needs to be hollow, becouse at the further part of the script I export the layout for printing. But I get the following error message:

Runtime error Traceback (most recent call last): File "", line 9, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\mapping.py", line 1869, in UpdateLayer assert isinstance(update_layer, Layer) AssertionError My original code looks like:

if "something.mxd" in path or "otherthing.mxd" in path: if len(arcpy.Describe("mylayer").FIDSet.split('; ')) == 1: mxd =arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] arcpy.Buffer_analysis("Kutak", "Buffers.shp", "1000 Meters") updateLyr = arcpy.mapping.ListLayers(mxd, "Buffers.shp") sourceLayer = arcpy.mapping.Layer(r"style_ref.lyr") arcpy.mapping.UpdateLayer(df, updateLyr, sourceLayer, True) Any ideas?



أكثر...
 
أعلى