Tag Info

New answers tagged

1

As commented by @Luke, and as we were both working towards: If that is your actual code, your for lyr in arcpy.mapping.ListLayers(mxd): loop will only run on the final mxd as it is not indented to be inside the for file in mxdList: loop. Instead of your code try: import arcpy, os #workspace to search for MXDs Workspace = ...


2

Your error says it all. It is poor formatting. Python relies on indentations. Format it like: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") for lyr in arcpy.mapping.ListLayers(mxd): if lyr.symbologyType == "GRADUATED_SYMBOLS": lyr.symbology.valueField = "POP2007" lyr.symbology.numClasses = 5 del mxd Edit: Just ...


1

Use classLabels from the UniqueValuesSymbology class mxd = arcpy.mapping.MapDocument(path_to_your_mxd) lyr = arcpy.mapping.ListLayers(m)[0] print(lyr.symbology.classLabels) Relevant documentation: http://resources.arcgis.com/en/help/main/10.2/index.html#/UniqueValuesSymbology/00s30000005s000000/


0

You have to remeber that the arcpy module is really just a wrapper around a huge COM library. Most of the time it usually works but every once in a while you run into something like this. My guess is that the problem is in the underlying COM library, in which case this could be difficult to deal with. One thing you can try, although this is a long shot, ...


2

i don't trust the gc module as much as I do spawning a separate process. The separate process will do the work and will then be killed after the join(). Try adding: from multiprocessing import process to the top of your script then replace: exportAISMap(mxd_path, pdf_path) with p = Process(target = exportAISMap, args = (mxd_path, pdf_path)) ...


3

Set Data source Tool you run in ArcGIS Desktop is not available directly as a GP tool. The exact logic behind it is not exposed to the end user. You can do that what this tool does in arcpy (with more advanced options): Updating and fixing data sources with arcpy.mapping (arcpy.mapping). The arcpy function that is the closest in terms of functionality is ...


3

I think the parameters in arcpy.mapping.ListLayers() are out of order. As described in the help documentation, the first parameter is the map document, the second parameter is the wildcard, and the third parameter is the data frame. You have passed in your dataFrame variable as your wildcard, which is why your layers are being filtered. Not sure why you ...



Top 50 recent answers are included