Performance Issue when using arcpy.mapping.ListDataFrames

Discussion created by sernst on Nov 7, 2011
Latest reply on Nov 23, 2011 by sernst
I am using arcpy.mapping to create an atlas that will run via ArcGIS Server - the atlas uses two dataframes.  One of the dataframes holds the data driven pages grid and the other dataframe has a locked extent (so it zooms to wherever the atlas dataframe is zoomed to).  Everything works very well, except very slow performance for one step of my code. 

Here's some of the code I'm running- to find the mxd and then start updating some definition queries in my second dataframe (the one that has a locked extent):

mxd = arcpy.mapping.MapDocument(r"pathtomxd.mxd")

for df in arcpy.mapping.ListDataFrames(mxd, "Street View"):

When I compare the two datetime stamps- there is a 7 minute gap between the two.  Why is that?  The rest of the code runs in just about a minute (which is fine since it is exporting a whole map book).  But I just can't figure out why this one step takes 7 minutes.

Any ideas would be most appreciated!  :D