i am unable to generate pdf report using ExportReport function of Arcgis 10.2. getting error of IOError: Could not open report template
tried different template files but still getting this error. Template directory is correct. checked all the directory positions.
Code:
<SPAN class="kwd" style="color: #00008b;">import</SPAN><SPAN class="pln" style="color: #000000;"> arcpy<BR />mxd </SPAN><SPAN class="pun" style="color: #000000;">=</SPAN><SPAN class="pln" style="color: #000000;"> arcpy</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="pln" style="color: #000000;">mapping</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="typ" style="color: #2b91af;">MapDocument</SPAN><SPAN class="pun" style="color: #000000;">(</SPAN><SPAN class="pln" style="color: #000000;">r</SPAN><SPAN class="str" style="color: #800000;">"C:\Users\Abrar ahmad\Documents\ArcGIS\New_Rwp_Cencus(12-17-2014).mxd"</SPAN><SPAN class="pun" style="color: #000000;">)</SPAN><SPAN class="pln" style="color: #000000;"><BR />df </SPAN><SPAN class="pun" style="color: #000000;">=</SPAN><SPAN class="pln" style="color: #000000;"> arcpy</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="pln" style="color: #000000;">mapping</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="typ" style="color: #2b91af;">ListDataFrames</SPAN><SPAN class="pun" style="color: #000000;">(</SPAN><SPAN class="pln" style="color: #000000;">mxd</SPAN><SPAN class="pun" style="color: #000000;">)[</SPAN><SPAN class="lit" style="color: #800000;">0</SPAN><SPAN class="pun" style="color: #000000;">]</SPAN><SPAN class="pln" style="color: #000000;"><BR /></SPAN><SPAN class="kwd" style="color: #00008b;">for</SPAN><SPAN class="pln" style="color: #000000;"> lyr </SPAN><SPAN class="kwd" style="color: #00008b;">in</SPAN><SPAN class="pln" style="color: #000000;"> arcpy</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="pln" style="color: #000000;">mapping</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="typ" style="color: #2b91af;">ListLayers</SPAN><SPAN class="pun" style="color: #000000;">(</SPAN><SPAN class="pln" style="color: #000000;">mxd</SPAN><SPAN class="pun" style="color: #000000;">,</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="str" style="color: #800000;">""</SPAN><SPAN class="pun" style="color: #000000;">,</SPAN><SPAN class="pln" style="color: #000000;">df</SPAN><SPAN class="pun" style="color: #000000;">):</SPAN><SPAN class="pln" style="color: #000000;"><BR /></SPAN><SPAN class="kwd" style="color: #00008b;">if</SPAN><SPAN class="pln" style="color: #000000;"> lyr</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="pln" style="color: #000000;">name </SPAN><SPAN class="pun" style="color: #000000;">==</SPAN><SPAN class="pln" style="color: #000000;"> </SPAN><SPAN class="str" style="color: #800000;">"New_Districts_5_without_limit"</SPAN><SPAN class="pun" style="color: #000000;">:</SPAN><SPAN class="pln" style="color: #000000;"><BR /> arcpy</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="pln" style="color: #000000;">mapping</SPAN><SPAN class="pun" style="color: #000000;">.</SPAN><SPAN class="typ" style="color: #2b91af;">ExportReport</SPAN><SPAN class="pun" style="color: #000000;">(</SPAN><SPAN class="pln" style="color: #000000;">lyr</SPAN><SPAN class="pun" style="color: #000000;">,</SPAN><SPAN class="pln" style="color: #000000;">r</SPAN><SPAN class="str" style="color: #800000;">"C:\Users\Abrar ahmad\Documents\ArcGIS\test.rlf"</SPAN><SPAN class="pun" style="color: #000000;">,</SPAN><SPAN class="pln" style="color: #000000;">r</SPAN><SPAN class="str" style="color: #800000;">"C:\Users\Abrar ahmad\Documents\ArcGIS\ProjectReport2.pdf"</SPAN><SPAN class="pun" style="color: #000000;">,</SPAN><SPAN class="str" style="color: #800000;">"USE_RLF"</SPAN><SPAN class="pun" style="color: #000000;">)</SPAN><SPAN class="pln" style="color: #000000;"><BR /></SPAN><SPAN class="kwd" style="color: #00008b;">del</SPAN><SPAN class="pln" style="color: #000000;"> mxd</SPAN>
Complete Error Data:
Runtime error Traceback (most recent call last): File "", line 7, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\mapping.py", line 515, 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 open report template