<?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 defining arcpy outputs and general practice in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057697#M61112</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm very new to python and i'm currently writing a script for one of my MSc Modules.&lt;/P&gt;&lt;P&gt;we have been given some ascii files that we need to convert to rasters, then define a projection and reproject them to british national grid. i'm currently having trouble with working out how to get python to output to specific folders and how to make the file names comply with tool parameters&amp;nbsp;&lt;/P&gt;&lt;P&gt;current code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Df1soton_0-1620924050649.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13282iB848522CA469851B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Df1soton_0-1620924050649.png" alt="Df1soton_0-1620924050649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;error message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Df1soton_1-1620924158419.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13283iC5A5C4932DA404D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Df1soton_1-1620924158419.png" alt="Df1soton_1-1620924158419.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 May 2021 16:42:53 GMT</pubDate>
    <dc:creator>Df1soton</dc:creator>
    <dc:date>2021-05-13T16:42:53Z</dc:date>
    <item>
      <title>defining arcpy outputs and general practice</title>
      <link>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057697#M61112</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm very new to python and i'm currently writing a script for one of my MSc Modules.&lt;/P&gt;&lt;P&gt;we have been given some ascii files that we need to convert to rasters, then define a projection and reproject them to british national grid. i'm currently having trouble with working out how to get python to output to specific folders and how to make the file names comply with tool parameters&amp;nbsp;&lt;/P&gt;&lt;P&gt;current code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Df1soton_0-1620924050649.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13282iB848522CA469851B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Df1soton_0-1620924050649.png" alt="Df1soton_0-1620924050649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;error message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Df1soton_1-1620924158419.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13283iC5A5C4932DA404D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Df1soton_1-1620924158419.png" alt="Df1soton_1-1620924158419.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 16:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057697#M61112</guid>
      <dc:creator>Df1soton</dc:creator>
      <dc:date>2021-05-13T16:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: defining arcpy outputs and general practice</title>
      <link>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057709#M61114</link>
      <description>&lt;P&gt;Its hard to read your screen captures; if you expand the three dots on the menu bar and choose the &amp;lt;/&amp;gt; icon you can enter your text as python code to make it easier to read.&amp;nbsp; That said, you can s&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/env.htm" target="_self"&gt;et an environment parameter to overwrite&lt;/A&gt; existing features every time you run the script.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import arcpy
arcpy.env.overwriteOutput = True&lt;/LI-CODE&gt;&lt;P&gt;This approach has a storied history of sometimes not working, so you can look at the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/exists.htm" target="_self"&gt;arcpy exists method.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And if/when that doesn't work, you can pull out the big hammer and use &lt;A href="https://www.geeksforgeeks.org/python-os-path-exists-method/" target="_self"&gt;python os.exists() method.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 17:03:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057709#M61114</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-05-13T17:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: defining arcpy outputs and general practice</title>
      <link>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057712#M61115</link>
      <description>&lt;P&gt;You're not dynamically creating &lt;FONT face="courier new,courier"&gt;outpudata&lt;/FONT&gt; so it's trying to overwrite the same thing over and over. If that's not what you want, then you should be creating&amp;nbsp;&lt;FONT face="courier new,courier"&gt;outpudata&lt;/FONT&gt; similarly to how you do in the loop before. Additionally, &lt;FONT face="courier new,courier"&gt;Outdir&lt;/FONT&gt; should not have that trailing underscore character when it's defined at the top unless you actually have a folder named "_".&lt;/P&gt;&lt;P&gt;Where you're adding the rasters to the &lt;FONT face="courier new,courier"&gt;conversion&lt;/FONT&gt; list, try just adding a string as a file path to the raster instead of an arcpy raster object.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 17:29:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057712#M61115</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-05-13T17:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: defining arcpy outputs and general practice</title>
      <link>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057772#M61116</link>
      <description>&lt;P&gt;For future reference,&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;would help with code readability, rather than screen grabs&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 19:20:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/defining-arcpy-outputs-and-general-practice/m-p/1057772#M61116</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-13T19:20:46Z</dc:date>
    </item>
  </channel>
</rss>

