I'm using ArcGIS 10.0 sp5 on a Win7 PC and need help with a script to turn layers on/off and export the page layout to an image file. The script works until the ExportToPNG(). I have 281 layers with up to 10 attributes I have to map (static extent) so scripting the arduous task of changing each layers visibility is preferred. I have a VBA tool to change the symbology between the 10 attributes of selected layers and now I'd like to take advantage of the arcpy.mapping functionalities.import os, sys, string, arcpy # define list of species spLst = ['0070','1320'] try: mxd = arcpy.mapping.MapDocument(r"C:/Workspace/Species.mxd") # check for broken paths brknList = arcpy.mapping.ListBrokenDataSources(mxd) if len(brknList) >= 1: print "Broken Paths Exist..." + brknList else: for sp in spLst: print "No broken paths, proceeding" lyrName = "ew20km_in" + str(sp) + "_2040" lyrList = arcpy.mapping.ListLayers(mxd, lyrName) for lyr in lyrList: # define variables out_png1 = r"C:/Workspace/pixels_500/rfbird_" + str(sp) + "_2040.png" out_png2 = r"C:/Workspace/pixels_800/rfbird_" + str(sp) + "_2040.png" resolution1 = 45 resolution2 = 72 lyr.visible = True # make layer visible, all other species should start as invisible arcpy.RefreshTOC() arcpy.RefreshActiveView() # export current layout view to png file # ExportToPNG (map_document, out_png, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, {background_color}, {transparent_color}, {interlaced}) arcpy.mapping.ExportToPNG(mxd, out_png1, "PAGE_LAYOUT", "", "", resolution1, "", "24-BIT_TRUE_COLOR", "", "", "") arcpy.mapping.ExportToPNG(mxd, out_png2, "PAGE_LAYOUT", "", "", resolution2, "", "24-BIT_TRUE_COLOR", "", "", "") lyr.visible = False except: arcpy.AddMessage(arcpy.GetMessages(2)) print arcpy.GetMessages (2) print "Exited with Errors.... Something is wrong"