I have some spatial bookmarks in my MXD file and i want to export each and every bookmark as one jpeg file. I have found below code but it is giving an error.
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\SOFTWARE\Python\test.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "test")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
df.extent = bkmk.extent
outFile = r"C:\SOFTWARE\Python\Out\\" + bkmk.name + ".jpg"
arcpy.mapping.ExportToJPEG(mxd, outFile, df)
del mxd
After running above code, it is giving error as
df = arcpy.mapping.ListDataFrames(mxd, "test")[0]
IndexError: list index out of range
How do I export each bookmark as jpeg with the above code?