I was running arcpy.mapping tools and noted different behaviour running inside ArcMap python window and outside of it. The following is the partial code extract.
mxd = arcpy.mapping.MapDocument(mxdLocation) df = arcpy.mapping.ListDataFrames(mxd) lyr = arcpy.mapping.ListLayers(mxd,data_frame=df)currentLyrExtent=lyr.getExtent()
df.extent = currentLyrExtent
This is the exported image after running in ArcMap Python window. Looks ok.
This is the exported image after running outside of ArcMap. The image only fills up 1/4 of the whole image frame.
What could be wrong?
When altering between inside / outside of ArcMAP, can you confirm you just change the line of code:
mxd = arcpy.mapping.MapDocument(mxdLocation) tomxd = arcpy.mapping.MapDocument("CURRENT") and everything else remains the same?
There are no changes in codes when i alter between inside/outside of ArcMap. Both are as follows.
mxdLocation=r"c:\myfolder\mymap.mxd"mxd = arcpy.mapping.MapDocument(mxdLocation)