<?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: How to configure a python web tool with file output in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-configure-a-python-web-tool-with-file/m-p/263677#M20343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks to Anthony Giles of esri for getting me closer to the solution.&lt;/P&gt;&lt;P&gt;On this page:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/gp-service-example-basic-high-quality-webmap-printing.htm" title="https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/gp-service-example-basic-high-quality-webmap-printing.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Tutorial: Print a web map and export a vector output PDF document using ArcPy—ArcGIS Server | Documentation for ArcGIS E…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I learned that my output parameter line in the code needed to look like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class=""&gt;.&lt;/SPAN&gt;SetParameterAsText&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; outputFile&lt;SPAN class=""&gt;)
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and voila! The code works in pro and after republishing and running an HTML file is generated on the hosting server in C:\arcgisserver\directories\arcgisjobs\.......\webtool_output.html&lt;/P&gt;&lt;P&gt;However, the output tab of the geoprocessing widget shows nothing. (No errors, but no link to the output either.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. From the above link I also learned I had neglected to define the output parameter in the ArcGIS Pro Tool Properties.&amp;nbsp; Even if the user isn't queried to select an output filename, I still needed to define the output file parameter (Data Type: File, type: Derived, Direction: output).&amp;nbsp; Reran, republished, but the output tab is stubbornly blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. From this page:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/176433" target="_blank"&gt;https://community.esri.com/thread/176433&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried changing the output from derived to required, but it still hasn't fixed the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:55:36 GMT</pubDate>
    <dc:creator>TobiSellekaerts</dc:creator>
    <dc:date>2021-12-11T12:55:36Z</dc:date>
    <item>
      <title>How to configure a python web tool with file output</title>
      <link>https://community.esri.com/t5/python-questions/how-to-configure-a-python-web-tool-with-file/m-p/263676#M20342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to publish a python-based web tool which will output an html file.&amp;nbsp; I have the code working in ArcGIS Pro (2.6), and can publish it successfully. Everything seems to work except the output is not 'returned' to the user.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. At the start, to ensure it was working, I set the output to be a standard&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;arcpy&lt;SPAN class=""&gt;.&lt;/SPAN&gt;GetParameterAsText(#)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and chose an output file interactively.&amp;nbsp; In Pro, the script runs and the file is generated correctly.&amp;nbsp; When published (to a hosting server, 10.8), the script also works as expected but the output is not yet 'returned' to the user. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. So I modified the script to put the output file in the scratch folder:&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/CODE&gt;outputFile = os.path.join(arcpy.env.scratchFolder, "webtool_output.html")&lt;/PRE&gt;&lt;P&gt;This also works in Pro (although I don't see the output), and publishes and runs successfully in a Portal Web App, but the output isn't returned to the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I found this page:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/256944"&gt;Geoprocessing service to return a file&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and added&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;arcpy&lt;SPAN class=""&gt;.&lt;/SPAN&gt;SetParameter&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; file&lt;SPAN class=""&gt;.&lt;/SPAN&gt;name&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to the end of my code, but this throws an error in ArcGIS Pro (so won't publish as a service.)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. It seems like the answer to my question should be found here:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/share-analysis/inputs-and-outputs.htm#ESRI_SECTION1_F9702623473E4A7B9A95C82182894E73" title="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/share-analysis/inputs-and-outputs.htm#ESRI_SECTION1_F9702623473E4A7B9A95C82182894E73"&gt;Input and output parameters—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I would be able to work it out if I could find a functioning example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2020 14:46:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-configure-a-python-web-tool-with-file/m-p/263676#M20342</guid>
      <dc:creator>TobiSellekaerts</dc:creator>
      <dc:date>2020-10-06T14:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure a python web tool with file output</title>
      <link>https://community.esri.com/t5/python-questions/how-to-configure-a-python-web-tool-with-file/m-p/263677#M20343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks to Anthony Giles of esri for getting me closer to the solution.&lt;/P&gt;&lt;P&gt;On this page:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/gp-service-example-basic-high-quality-webmap-printing.htm" title="https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/gp-service-example-basic-high-quality-webmap-printing.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Tutorial: Print a web map and export a vector output PDF document using ArcPy—ArcGIS Server | Documentation for ArcGIS E…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I learned that my output parameter line in the code needed to look like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class=""&gt;.&lt;/SPAN&gt;SetParameterAsText&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; outputFile&lt;SPAN class=""&gt;)
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and voila! The code works in pro and after republishing and running an HTML file is generated on the hosting server in C:\arcgisserver\directories\arcgisjobs\.......\webtool_output.html&lt;/P&gt;&lt;P&gt;However, the output tab of the geoprocessing widget shows nothing. (No errors, but no link to the output either.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. From the above link I also learned I had neglected to define the output parameter in the ArcGIS Pro Tool Properties.&amp;nbsp; Even if the user isn't queried to select an output filename, I still needed to define the output file parameter (Data Type: File, type: Derived, Direction: output).&amp;nbsp; Reran, republished, but the output tab is stubbornly blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. From this page:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/176433" target="_blank"&gt;https://community.esri.com/thread/176433&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried changing the output from derived to required, but it still hasn't fixed the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:55:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-configure-a-python-web-tool-with-file/m-p/263677#M20343</guid>
      <dc:creator>TobiSellekaerts</dc:creator>
      <dc:date>2021-12-11T12:55:36Z</dc:date>
    </item>
  </channel>
</rss>

