I am new to Python and have been researching the forums and other websites for tips on writing a Python code to get the layer descriptions from layers in an MXD and output those descriptions in a text file. This is what I have so far, but I am getting an exceptions.AttributeError 'str' object has no attribute '_arc_object'. I'm not sure what that error means or how to correct it. Thanks for any help!
# Setup # Import arcpy module import sys, string, os, arcpy from arcpy import env from arcpy import mapping
#Reference MXD and Data Frame mxd = arcpy.mapping.MapDocument("Current") the "CURRENT" keyword works only if you run the script from within the pythonwindow if you run your script from outside arcgis you must put the path/to/mxd and, when declaring the df:
not df = arcpy.mapping.ListDataFrames ("Layers")  but df = arcpy.mapping.ListDataFrames (mxd) 
Thank you. Your suggestions made the script run successfully. However, the output text file only contains the layer names and not the descriptions. I've attached it so you can see. Most of the layers have layer descriptions so they should show up.
Yes all but 3 of layers have descriptions. When I ran it again this morning, one description showed up but no others. And for the 3 layers with no descriptions, there was no N/A after it. Did the script work with your data when you tried to replicate the error?
I wonder if it is an issue with group layers. The one layer description that did show up was not a group layer. Most of the other layers in the MXD are group layers and the descriptions are not showing up. When you ran the script, were your layers group layers or single layer files?
Thanks the layer reporting script helped. I basically copied and pasted the items I want the report to show but I get an error on line 39 "UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 100: ordinal not in range(128) 'ascii' codec can't encode character u'\u2019' in position 100: ordinal not in range(128)." Do you know what this means? My new script is attached.