<?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 Python error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-error/m-p/276094#M21336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am simply using the ArcGIS Server Manager 10.0 web application wizard to run a geoprocessing model from within the associated map document. So, I the model sums acreage and writes the "Acreage" table to a geodatabase at specified location. I don't see a way to have the default web application builder display the Acreage results from within the web application, though. So, what I did was link the table to an Excel document. I am attempting to add a Python script to the model in order to open the Excel file to display the results, but get this error in the web application geoprocessing results:&lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt; Submitted.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing...&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Acreage): Acreage&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:05 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Select Layer By Attribute): SelectLayerByAttribute "Fuel Load (Acreage)" NEW_SELECTION "SIMPLE = 'Heavy Grass'"&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:06 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Succeeded at Wed Feb 05 15:46:06 2014 (Elapsed Time: 0.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Get Count): GetCount "Fuel Load (Acreage)"&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:06 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Row Count = 5&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Succeeded at Wed Feb 05 15:46:06 2014 (Elapsed Time: 0.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Summary Statistics): Statistics "Fuel Load (Acreage)" \\Path_to\webappdata.mdb\Acreage "ACREAGE SUM" #&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:06 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Succeeded at Wed Feb 05 15:46:09 2014 (Elapsed Time: 3.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (openxl): openxl&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:10 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Running script openxl...&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: : unexpected indent (acreage.py, line 7)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: Failed to execute (openxl).&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Failed at Wed Feb 05 15:46:12 2014 (Elapsed Time: 2.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: Failed to execute (Acreage).&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Failed at Wed Feb 05 15:46:13 2014 (Elapsed Time: 8.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: Failed.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the Python script:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## Import win32 to interact with Excel application
import win32com.client as win32

## To open Acreage table in Excel
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True
excel.Workbooks.Open(\\Path_to\Landuse\Acreages.xlsm)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone let me know what problem I may have in the script?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 13:27:22 GMT</pubDate>
    <dc:creator>BarryGuidry</dc:creator>
    <dc:date>2021-12-11T13:27:22Z</dc:date>
    <item>
      <title>Python error</title>
      <link>https://community.esri.com/t5/python-questions/python-error/m-p/276094#M21336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am simply using the ArcGIS Server Manager 10.0 web application wizard to run a geoprocessing model from within the associated map document. So, I the model sums acreage and writes the "Acreage" table to a geodatabase at specified location. I don't see a way to have the default web application builder display the Acreage results from within the web application, though. So, what I did was link the table to an Excel document. I am attempting to add a Python script to the model in order to open the Excel file to display the results, but get this error in the web application geoprocessing results:&lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt; Submitted.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing...&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Acreage): Acreage&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:05 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Select Layer By Attribute): SelectLayerByAttribute "Fuel Load (Acreage)" NEW_SELECTION "SIMPLE = 'Heavy Grass'"&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:06 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Succeeded at Wed Feb 05 15:46:06 2014 (Elapsed Time: 0.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Get Count): GetCount "Fuel Load (Acreage)"&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:06 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Row Count = 5&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Succeeded at Wed Feb 05 15:46:06 2014 (Elapsed Time: 0.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (Summary Statistics): Statistics "Fuel Load (Acreage)" \\Path_to\webappdata.mdb\Acreage "ACREAGE SUM" #&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:06 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Succeeded at Wed Feb 05 15:46:09 2014 (Elapsed Time: 3.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Executing (openxl): openxl&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Start Time: Wed Feb 05 15:46:10 2014&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Running script openxl...&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: : unexpected indent (acreage.py, line 7)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: Failed to execute (openxl).&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Failed at Wed Feb 05 15:46:12 2014 (Elapsed Time: 2.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: Failed to execute (Acreage).&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Failed at Wed Feb 05 15:46:13 2014 (Elapsed Time: 8.00 seconds)&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Error: Failed.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the Python script:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## Import win32 to interact with Excel application
import win32com.client as win32

## To open Acreage table in Excel
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True
excel.Workbooks.Open(\\Path_to\Landuse\Acreages.xlsm)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone let me know what problem I may have in the script?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:27:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error/m-p/276094#M21336</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2021-12-11T13:27:22Z</dc:date>
    </item>
  </channel>
</rss>

