Guest User

Untitled

a guest
Dec 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import arcpy
  2. mxd = arcpy.mapping.MapDocument(r"C:UsersP51DesktoptestingLABEL.mxd")
  3. df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
  4. layer = arcpy.mapping.ListLayers(mxd, "point10", "Layers")[0]
  5. layer.showLabels = True
  6.  
  7. Runtime error Traceback (most recent call last):
  8. File "<string>", line 4, in <module>
  9. File "c:program files (x86)arcgisdesktop10.4arcpyarcpyutils.py", line 182, in fn_
  10. return fn(*args, **kw)
  11. File "c:program files (x86)arcgisdesktop10.4arcpyarcpymapping.py", line 1517, in ListLayers
  12. result = mixins.MapDocumentMixin(map_document_or_layer).listLayers(wildcard, data_frame) File "c:program files (x86)arcgisdesktop10.4arcpyarcpyarcobjectsmixins.py", line 843, in listLayers
  13. raise TypeError(str(type(dataframe))) TypeError: <type 'str'>
  14.  
  15. ListLayers (map_document_or_layer, {wildcard}, {data_frame})
  16.  
  17. layer = arcpy.mapping.ListLayers(mxd, "point10", "Layers")[0]
  18.  
  19. df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
  20.  
  21. layer = arcpy.mapping.ListLayers(mxd, "point10", df)[0]
Add Comment
Please, Sign In to add comment