AnsweredAssumed Answered

Not able to run python script outside of ArcMap

Question asked by Mishko on Aug 2, 2012
Latest reply on Aug 2, 2012 by Mishko
I have been unable to get a python script that references a data driven pages mxd to run outside of ArcMap. This is a sample from the ArcGIS Resource Center (bottom of the page) that I'm using as a base:

import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):   mxd.dataDrivenPages.currentPageID = pageNum   arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" + str(pageNum) + ".png") del mxd

I'm attempting to modify the above code for my particular use (I do change the reference to a map document from "CURRENT" to an mxd on disk), but it won't run from a command line or an IDE (PyScripter); I don't get any errors, it's simply that nothing happens. Well, there's a pause for two to three seconds and then nothing.

This runs fine from the python window in ArcMap. There must be something I haven't run across in my extensive searching on this issue, or it's so simple I'm overlooking it. What am I missing??

I will disclose that I'm new-ish to python and programming in general, and I'm running ArcGIS 10 SP4 on Windows 7. Also, the map document that I'm referencing is over 8,000 pages. Not sure if that makes a difference, but thought I would mention it.

Thank you,