I have a script that is run on a daily basis to export a folder of MXDs to PDFs and I have noticed some peculiar behavior. Many, but not all of the PDFs will be missing some labels or their label orientation gets changed. These errors do not occur when I manually export from arcmap. In an attempt to isolate the problem, I wrote a code snippet to simply export a PDF and it behaved normally, no errors.
Is there a reason that stepping through a folder of MXDs would cause this error?
I have included the code below.
import arcpy import os arcpy.env.workspace = r"\\fs1\shared\GIS\Map_Documents\NightlyUpdates" ws = arcpy.env.workspace outPDF = r"\\fs1\shared\GIS\Map_Documents\NightlyUpdates\PDF" MXDlist = arcpy.ListFiles("*.mxd") for MXD in MXDlist: root = os.path.splitext(MXD) title = '\\'+ root + ".pdf" tempMXD = arcpy.mapping.MapDocument(os.path.join(ws,MXD)) arcpy.mapping.ExportToPDF(tempMXD, outPDF+title, image_quality="BETTER") del tempMXD