Hey guys,
I working to get a report to run from a script and I can not figure out what I'm doing wrong. Any help you would have would be great. Thanks!
import arcpy
mxd = arcpy.mapping.MapDocument(r"G:\Public\Storm Projects\NPDES II Permit\Detention Basin Inspections\NEW_Detention Basins.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListTableViews(mxd, "ArcGISSDE.SDE.Detention_Basin_Inspection", df)[0]
arcpy.SelectLayerByAttribute_management(lyr, "SUBSET_SELECTION", "[Date]= '12/1/2015'")
print ('Test')
arcpy.mapping.ExportReport(lyr,
r"M:\BrianLomas\RelationShipClassTest\DetentionBasin1.rlf",
r"C:\Users\blomas\Desktop\ReportTest.pdf",
"SELECTED")
del mxd
I currently get this error...
Executing: Report
Start Time: Mon Feb 27 13:47:32 2017
Running script Report...
Failed script Report...
Traceback (most recent call last):
File "M:\BrianLomas\Python Scripts\ImportantScripts\SelectReport.py", line 10, in <module>
"SELECTED")
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\utils.py", line 182, in fn_
return fn(*args, **kw)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\mapping.py", line 532, in ExportReport
return report_source._arc_object.ExportReport(*gp_fixargs((report_layout_file, output_file, dataset_option, report_title, starting_page_number, page_range, report_definition_query, extent, field_map), True))
IOError: Could not write output file from report
Failed to execute (Report).
Failed at Mon Feb 27 13:47:34 2017 (Elapsed Time: 1.90 seconds)