(Edit: I shortened the script as a big portion of it wasn't part of the main problem.)
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.
Here is the script used:
<SPAN class="keyword token">if</SPAN> srcDesc<SPAN class="punctuation token">.</SPAN>SpatialReference<SPAN class="punctuation token">.</SPAN>Name <SPAN class="operator token">==</SPAN> targetDesc<SPAN class="punctuation token">.</SPAN>SpatialReference<SPAN class="punctuation token">.</SPAN>Name<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">continue</SPAN>
<SPAN class="comment token">#Shapefiles in the targeted folder that don't match will reprojected to the selected shapefile.</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#Replaces the TargetFolder's ".shp" at the end of the end of the name with "_projected."</SPAN>
ReprojectedData <SPAN class="operator token">=</SPAN> InFolder<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN><SPAN class="string token">".shp"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"_projected"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Tool re-projects the datasets that doesn't match the spatial reference of the targeted shapefile.</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Project_management<SPAN class="punctuation token">(</SPAN>InFolder<SPAN class="punctuation token">,</SPAN> ReprojectedData<SPAN class="punctuation token">,</SPAN> InFile<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Displays a message of success of the projected datasets.print "Projected " + str(InFolder)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Projected "</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>InFolder<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Is there a different way of using an overwrite output for a script such as this?