well the indentation is already preserved when i write the syntax.
import arcpy.mapping as mapping, os path = r"C:" f = open('filename_here.txt','w') for root,dirs,files in os.walk(path): for filename in files: basename, extension = os.path.splitext(filename) if extension == ".mxd": fullPath = os.path.join(path,filename) mxd = mapping.MapDocument(fullPath) f.write("MXD: " + filename + "\n") brknList = mapping.ListBrokenDataSources(mxd) for brknItem in brknList: f.write("\t" + brknItem.name + "\n") f.close()
fullPath = os.path.join(root,filename)
import arcpy.mapping as mapping, os path = r"C:" f = open('filename_here.txt','w') for root,dirs,files in os.walk(path): for filename in files: basename, extension = os.path.splitext(filename) if extension == ".mxd": fullPath = os.path.join(root,filename) mxd = mapping.MapDocument(fullPath) f.write("MXD: " + filename + "\n") brknList = mapping.ListBrokenDataSources(mxd) for brknItem in brknList: f.write("\t" + brknItem.name + "\n") f.close()
You need to tell us what the exact error is, it's very important. Copy the entire error message and post it here.Also, please enclose your python code in [noparse][/noparse] tags to preserve the indentation. This is very important as indentation is is part of the syntax. See this post for further information.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.