Mysterious 🙂
How can it be that this code produces something like multiple recursive printing of the map?
import arcpy mxd = arcpy.mapping.MapDocument(r"path") df = arcpy.mapping.ListDataFrames(mxd)[0] arcpy.mapping.PrintMap(mxd, r"printer", df)
The DataFrame object is also used as an optional parameter to distinguish printing or export a data frame versus a page layout. For this reason it is important to uniquely name each data frame so a specific data frame can be easily referenced. From the help
What are your data frame names? are they all unique
Now they are two and different?
Layer and NewDataFrame
Can you provide a link to where you found this code snippet, and why you might think this might work recursively?
If you got the code from the PrintMap help page, example two, it says that this only prints the first data frame ([0]). If you want to loop through all data frames, use a for loop and change the df variable.
import arcpy mxd = arcpy.mapping.MapDocument(r"path") dfs = arcpy.mapping.ListDataFrames(mxd) for df in dfs: arcpy.mapping.PrintMap(mxd, r"printer", df)
If this isn't what you're asking, please try rephrasing your question.