I am trying to export data driven pages using Arcpy butmxd.dataDrivenPages.pageCount
return 0.
Here what i am doing... first I am replacing the data source of the layer then refreshing the data driven pages and after that using for loop trying to export data driven pages in jpeg.
Here what I am trying..
lyr.replaceDataSource(path_of_data_source, "SHAPEFILE_WORKSPACE", "data_source_name")
mxd.dataDrivenPages.refresh()
for pageNum in range(1,mxd.dataDrivenPages.pageCount + 1): arcpy.AddMessage("Image "+ str(pageNum)) mxd.dataDrivenPages.currentPageID = pageNum arcpy.mapping.ExportToJPEG(mxd, directory_env + "\Output_Images/" + str(pageNum) + ".jpeg", resolution = 300)del mxd