<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting error in running ExportReport Python code in ArcMap? in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654095#M4462</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks it helped me.. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Mar 2015 18:54:59 GMT</pubDate>
    <dc:creator>waqarahmad</dc:creator>
    <dc:date>2015-03-07T18:54:59Z</dc:date>
    <item>
      <title>Getting error in running ExportReport Python code in ArcMap?</title>
      <link>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654093#M4460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;i am unable to generate pdf report using ExportReport function of Arcgis 10.2. getting error of &lt;STRONG&gt;IOError: Could not open report template&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;tried different template files but still getting this error. Template directory is correct. checked all the directory positions.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;&lt;STRONG style="font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;Code:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy&lt;BR /&gt;mxd &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;MapDocument&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;r&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\Users\Abrar ahmad\Documents\ArcGIS\New_Rwp_Cencus(12-17-2014).mxd"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;df &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;ListDataFrames&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mxd&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)[&lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; lyr &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;ListLayers&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mxd&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;""&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;df&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;):&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; lyr&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;name &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;==&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"New_Districts_5_without_limit"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;ExportReport&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;lyr&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;r&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\Users\Abrar ahmad\Documents\ArcGIS\test.rlf"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;r&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\Users\Abrar ahmad\Documents\ArcGIS\ProjectReport2.pdf"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"USE_RLF"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;del&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; mxd&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;&lt;STRONG&gt;Complete Error Data:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;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&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 18:45:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654093#M4460</guid>
      <dc:creator>waqarahmad</dc:creator>
      <dc:date>2015-03-06T18:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error in running ExportReport Python code in ArcMap?</title>
      <link>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654094#M4461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Execute your code inside try/except/finally and see if this gives some hint:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000000q000000" title="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000000q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Arcpy exception handling&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import sys
import traceback
mxd = arcpy.mapping.MapDocument(r"C:\Users\Abrar ahmad\Documents\ArcGIS\New_Rwp_Cencus(12-17-2014).mxd")
try:

&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd)[0]
&amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd, "",df):
&amp;nbsp; if lyr.name == "New_Districts_5_without_limit":
&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportReport(lyr,r"C:\Users\Abrar ahmad\Documents\ArcGIS\test.rlf",r"C:\Users\Abrar ahmad\Documents\ArcGIS\ProjectReport2.pdf","USE_RLF")

except arcpy.ExecuteError: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get the tool error messages 
&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = arcpy.GetMessages(2) 


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Return tool error messages for use with a script tool 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(msgs) 


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print tool error messages for use in Python/PythonWin 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs


except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get the traceback object
&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Concatenate information together concerning the error into a message string
&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Return python error messages for use in script tool or Python Window
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(pymsg)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(msgs)


&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print Python error messages for use in Python / Python Window
&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs
finally:
&amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:42:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654094#M4461</guid>
      <dc:creator>MahtabAlam1</dc:creator>
      <dc:date>2021-12-12T03:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error in running ExportReport Python code in ArcMap?</title>
      <link>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654095#M4462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks it helped me.. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Mar 2015 18:54:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/654095#M4462</guid>
      <dc:creator>waqarahmad</dc:creator>
      <dc:date>2015-03-07T18:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error in running ExportReport Python code in ArcMap?</title>
      <link>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/1007775#M5700</link>
      <description>&lt;P&gt;I am struggling with this as well (ArcMap 10.7) and when I added all of that great error reporting. And to me it was revealed:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could not open report template&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its not a network drive issue ( i moved the rlf files to my local HD). The paths seem fine. the table view is fine. Very frustrated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 17:46:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/getting-error-in-running-exportreport-python-code/m-p/1007775#M5700</guid>
      <dc:creator>DanDeegan</dc:creator>
      <dc:date>2020-12-08T17:46:05Z</dc:date>
    </item>
  </channel>
</rss>

