Selecting specifc layers to output to PDF

Discussion created by Drivium on Mar 4, 2014
Latest reply on Mar 4, 2014 by Drivium
Not sure where I'm going wrong...  The script completes successfully, but outputs all layers, not just the ones I'm selecting.  I'm trying to produce a PDF with specific bookmarks (working), using specific layers (not working).  Any idea why this might be?  TIA

import arcpy, os

mxd = arcpy.mapping.MapDocument(r"I:\GIS_Workspace\Output\test.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Test")[0]
for lyr in arcpy.mapping.ListLayers(mxd, "*", df):

    if lyr.name in ["Sections","MGT"]:

        for bkmk in [bkmk for bkmk in arcpy.mapping.ListBookmarks(mxd,"*",df) if bkmk.name in ["North","Middle"]]:
            mxd = arcpy.mapping.MapDocument(r"I:\GIS_Workspace\Output\test.mxd")
            df.extent = bkmk.extent
            #df.scale *= 1.5
            #df.Scale = 1000 # 1:5,000
            outFile = r"I:\GIS_Workspace\Output\\" + bkmk.name + ".pdf"
            arcpy.mapping.ExportToPDF(mxd, outFile, df, picture_symbol="VECTORIZE_BITMAP",layers_attributes="LAYERS_AND_ATTRIBUTES", df_export_width=25000, df_export_height=25000)

            del mxd