<?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: Overwrite Output Error 999999 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372687#M29456</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jacob could you format your code so that it has line numbers&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Sep 2018 16:52:36 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-09-08T16:52:36Z</dc:date>
    <item>
      <title>Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372686#M29455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;(Edit: I shortened the script as a big portion of it wasn't part of the main problem.)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on a script to re-project shapefiles from a selected shapefile with a different projection. While the execution of the tool works, it fails when overwriting the same file regardless of adding in arcpy.env.overwriteOutput = True.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the script used:&lt;/P&gt;&lt;DIV&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; srcDesc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SpatialReference&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; targetDesc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SpatialReference&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Name&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;continue&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Shapefiles in the targeted folder that don't match will reprojected to the selected shapefile.&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Replaces the TargetFolder's ".shp" at the end&amp;nbsp; of the end of the name with "_projected."&lt;/SPAN&gt;

ReprojectedData &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; InFolder&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;".shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_projected"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Tool re-projects the datasets that doesn't match the spatial reference of the targeted shapefile.&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Project_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;InFolder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ReprojectedData&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; InFile&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Displays a message of success of the projected datasets.print "Projected " + str(InFolder)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Projected "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;InFolder&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a different way of using an overwrite output for a script such as this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:14:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372686#M29455</guid>
      <dc:creator>JacobHorwitz1</dc:creator>
      <dc:date>2021-12-11T17:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372687#M29456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jacob could you format your code so that it has line numbers&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2018 16:52:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372687#M29456</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-09-08T16:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372688#M29457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reupdated the post for Syntax Highlighter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2018 21:14:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372688#M29457</guid>
      <dc:creator>JacobHorwitz1</dc:creator>
      <dc:date>2018-09-08T21:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372689#M29458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your destination workspace a file geodatabse? I ask since you are replacing *.shp with _projected, implying such.&lt;/P&gt;&lt;P&gt;I also suggest that you dump the try-except block and dedent everything since the exception is not informative.&amp;nbsp; It is better to get a real error than a message that something failed.&amp;nbsp; Exception tracking will return the same error message for the most part, as dumping the try except block.&lt;/P&gt;&lt;P&gt;Sometimes it is just better to use a Delete_management, to delete existing data rather than relying on the overwriteOutput&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2018 21:49:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372689#M29458</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-09-08T21:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372690#M29459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have noticed the env overwrite is not always&amp;nbsp;honored. I typically delete (as Dan suggested) or add a number to the end of my names and increment&amp;nbsp;it to generate unqunie names,&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2018 16:41:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372690#M29459</guid>
      <dc:creator>forestknutsen1</dc:creator>
      <dc:date>2018-09-10T16:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372691#M29460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to finally find the solution! I had to add an extra ".shp" to "_projected" as &lt;STRONG&gt;"_projected.shp."&amp;nbsp;&lt;/STRONG&gt;to fix the Error: 999999.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 20:01:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/372691#M29460</guid>
      <dc:creator>JacobHorwitz1</dc:creator>
      <dc:date>2018-09-12T20:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Output Error 999999</title>
      <link>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/1121308#M63102</link>
      <description>&lt;P&gt;I've done this many many times when "overwriting" because setting overwrite to True often fails, causing my scripts to exit,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if arcpy.Exists(fc): arcpy.management.Delete(fc)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I've been seeing is when I publish a feature class to Portal with overwrite True and it creates a new service with the same name. You can't do "delete old and create new" because it will give the new layer a different unique ID and that means all your maps are broken.&lt;/P&gt;&lt;P&gt;(I came here because I saw Error 999999 and Overwrite in the "Related" column and got excited. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(I'm thinking of running off Error 999999 t-shirts, I think it would be a great inside joke for Esri users.)&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 16:45:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwrite-output-error-999999/m-p/1121308#M63102</guid>
      <dc:creator>Brian_Wilson</dc:creator>
      <dc:date>2021-11-30T16:45:37Z</dc:date>
    </item>
  </channel>
</rss>

