So I am fairly new to python scripting, but I have what seems like it should be a fairly simple script that selects an attribute from a layer, zooms to it, and then clears the selection and exports a png of the map. However, the CLEAR_SELECTION function doesn't actually seem to be doing anything, and all the maps the script outputs still have the selected feature highlighted in blue when it is outputted to the png.
Code:
# Import arcpy module
import arcpy
# Set Geoprocessing environments
arcpy.env.workspace = "*****"
##overwrites output
arcpy.env.overwriteOutput = True
#mapDocument
mxd = arcpy.mapping.MapDocument(*******.mxd")
#setting layer variable
addLayer = arcpy.mapping.Layer(********.lyr")
##setting dataset variable
df = arcpy.mapping.ListDataFrames(mxd)[0]
#select layer
arcpy.SelectLayerByAttribute_management(addLayer, "NEW_SELECTION", ' *********** ')
#set scale
df.scale = 7000000
##adds layer variable to mxd
arcpy.mapping.AddLayer(df, addLayer)
##zooms to layer
df.zoomToSelectedFeatures()
####unselect point
arcpy.SelectLayerByAttribute_management(addLayer,"CLEAR_SELECTION")
##exports current map extent to png
arcpy.mapping.ExportToPNG(mxd,*************,df,df_export_width=550,df_export_height=480)