(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:
if srcDesc.SpatialReference.Name == targetDesc.SpatialReference.Name:
#Shapefiles in the targeted folder that don't match will reprojected to the selected shapefile.
#Replaces the TargetFolder's ".shp" at the end of the end of the name with "_projected."
ReprojectedData = InFolder.replace(".shp", "_projected")
#Tool re-projects the datasets that doesn't match the spatial reference of the targeted shapefile.
arcpy.Project_management(InFolder, ReprojectedData, InFile)
#Displays a message of success of the projected datasets.print "Projected " + str(InFolder)
arcpy.AddMessage("Projected " + str(InFolder))
Is there a different way of using an overwrite output for a script such as this?