I need some real help. I have recently upgraded from ArcMap 10.6.1 to 10.8.1. The script worked in 10.6.1 but post upgrade it no longer works. I have tried to break down the script but no such luck. Here is what I have tried.
- recreate lyr file
- recreate rlf file
- tried referenceing mxd vs layer file
- run in foreground only.
Nothing has lead to success. If I run my code in ArcMap it runs successful but not in pyscripter or pythonIDE.
import arcpy
arcpy.env.overwriteOutput = True
fc = arcpy.mapping.Layer(r'E:\GIS\Data\GIS\Dept\CommDev\HistoricPreservation\Inventory\HistoricInventory.lyr')
fields = ['OBJECTID', 'propkey', 'curraddress']
# For each row, print the WELL_ID and WELL_TYPE fields, and
# the feature's x,y coordinates
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
print(u'{0}, {1}, {2}'.format(row[0], row[1], row[2]))
output = r'E:\GIS\Data\GIS\Dept\CommDev\HistoricPreservation\Inventory\Report.pdf'
rlf = r'E:\GIS\Data\GIS\Dept\CommDev\HistoricPreservation\Inventory\HistoricInventory_ReportLayout.rlf'
arcpy.mapping.ExportReport(fc,rlf,output)
Here is what was returned.
*** Remote Interpreter Reinitialized ***
100, 312020900, 315 W PROSPECT AV
Traceback (most recent call last):
File "<module1>", line 26, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.8\ArcPy\arcpy\utils.py", line 182, in fn_
return fn(*args, **kw)
File "C:\Program Files (x86)\ArcGIS\Desktop10.8\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))
RuntimeError: Error in generating report
@XanderBakker and @ManishPatel , I have seen you two post on this content before. Perhaps one of you might be able to help me with this.
Cheers,
Heath