Today I tried to run a script in ArcMap. Nothing fancy, just exporting data driven pages as jpegs in a for loop (basically taken straight from the help docs 2 years ago, and used in endless variations since):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|mxd = arcpy.mapping.MapDocument(r"C:\Some\Arb\Folder\Test.mxd")|
|fld = r"C:\Some\Arb\Folder\jpegs"|
|ddp = mxd.dataDrivenPages|
|for i in range(1, ddp.pageCount + 1):|
|ddp.currentPageId = i|
|name = os.path.join(fld, ddp.pageRow.getValue(ddp.pageNameField) + ".jpg")|
|print("Exported " + name)|
Of course, ArcMap crashes. No, not crashes, because then it would pop up the ESRI “Send Error Report” dialog box. It simply terminates. I run the same script in ArcCatalog and it works perfectly. Note that I have run scripts like this many times before in ArcMap without any issues. It’s almost as if ArcMap gets tired of certain things, and refuses to cooperate. I’m pretty sure if I try this script in ArcMap again in a few days time it will be fine.