atomaly

running Python against ArcGIS Engine

Discussion created by atomaly on Jul 17, 2013
Hi,

I'm trying to run a very simple Export mapbook mxd's to pdf, while i'm using the ArcGIS Engine License in my C#.net application..
the problem is you cannot export mapbooks (from my what I've read on here) using ArcObjects,
so i've written a .py script to be fired from my application...

it works fine in my development environment and on my development PC... uses the 64 bit python exe.
when it comes to deploying it to a machine with a standalone Engine license, the script fails

I've trying a whole bunch of things including "import arcengine" at the top.... still no success

any help would be greatly appreciated.

Tomas.

# Set license used 
import arcengine

# import the required modules for the python script
import arcpy

# Script arguments - production
mxdloc = arcpy.GetParameterAsText(0)
outputfolder = arcpy.GetParameterAsText(1)
figprefix = arcpy.GetParameterAsText(2)

mxd = arcpy.mapping.MapDocument(mxdloc)
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
 mxd.dataDrivenPages.currentPageID = pageNum
 arcpy.mapping.ExportToPDF(mxd, outputfolder + figprefix + str(mxd.dataDrivenPages.pageRow.Figure_No) + ".pdf")
 arcpy.AddMessage("Exported: " + figprefix + str(mxd.dataDrivenPages.pageRow.Figure_No) + " to " + outputfolder)
del mxd

Outcomes