Export report tool box

2900
3
Jump to solution
11-16-2014 05:50 AM
אילןעזריה
New Contributor


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:

error_report.png

Someone have an idea what can be the the reason for this error?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

                    2) select data frame   This line should be

#                    2) select data frame

you forgot to comment it out

View solution in original post

3 Replies
DanPatterson_Retired
MVP Emeritus

                    2) select data frame   This line should be

#                    2) select data frame

you forgot to comment it out

DanPatterson_Retired
MVP Emeritus

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?

0 Kudos
אילןעזריה
New Contributor

Hi,

The tool is working now.

Thank you.

0 Kudos