Hi,
I try to build a tool that export report to pdf file.
I used this example: ArcGIS Help 10.1 and I added parameters to a toolbox and write the python script:
# Date: November 11, 2014
# parameters:
# 1) Select Map Documents,
# 2) select data frame
# 3) Select Layer (points).
# 4) select report file (RLF).
# 5) Export report as pdf file.
import arcpy
#Read input parameters from script tool
#Select Map Documents
mxdPath = arcpy.GetParameterAsText(0)
#select data frame
dfName = arcpy.GetParameterAsText(1)
# Select Layer (points).
feature = arcpy.GetParameterAsText(2)
#select RLF file
report= arcpy.GetParameterAsText(3)
#select PDF file name
exportfile= arcpy.GetParameterAsText(4)
mxd = arcpy.mapping.MapDocument(mxdPath)
df = arcpy.mapping.ListDataFrames(mxd, dfName)[0]
lyr = arcpy.mapping.ListLayers(mxd, feature, df)[0]
arcpy.mapping.ExportReport(lyr,report,exportfile)
del mxd
Error message:
Someone have an idea what can be the the reason for this error?
Solved! Go to Solution.
2) select data frame This line should be
# 2) select data frame
you forgot to comment it out
2) select data frame This line should be
# 2) select data frame
you forgot to comment it out
I see you edited the original question to account for the missing comment as suggested...does this mean you are still getting the same error?
Hi,
The tool is working now.
Thank you.