As I understand it, overwriteOutput is an environment setting that controls whether an output overwrites an existing file of a duplicate name. Just re-checked the help pages, which confirms.
Despite having checked the relevant box in Geoprocessing > Geoprocessing Settings, as well as specified in my standalone python script that overwriteOutput = True, I received an error that the output file already exists.
bathy = r'F:\Joe_School\Thesis\data\kur_5m_bathy\kure_5m'
out_prof = r'F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\testprof'
import arcpy, os, math, time
from arcpy import env
import arcpy.management as DM
arcpy.CheckOutExtension("spatial")
env.overwriteOutput = True
desc = arcpy.Describe(bathy)
env.outputCoordinateSystem = desc.spatialReference
env.workspace = os.path.dirname(out_prof)
centroid = pointx, pointy = (367521.402, 3147853.81)
XMin = pointx - 200
XMax = pointx + 200
YMin = pointy - 200
YMax = pointy + 200
patch = SA.ExtractByRectangle(bathy, SA.Extent(XMin, YMin, XMax, YMax), "INSIDE")
DM.CreateFeatureclass(os.path.dirname(out_prof), os.path.basename(out_prof), "POLYLINE", "", "", "", patch)
It errors out on CreateFeatureClass.
Message File Name Line Position
Traceback
<module> <module1> 22
CreateFeatureclass c:\program files (x86)\arcgis\desktop10.3\ArcPy\arcpy\management.py 1807
ExecuteError: ERROR 000258: Output F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\testprof already exists
Failed to execute (CreateFeatureclass).
Given that there are 2 places that I know of to set this env setting, which takes precedent, and how do I make my script overwrite duplicate files?
I looked at arcpy.env.overwriteOutput = True appears not to be working?, but the problem there seemed to be with an associated function, and not the 'overwriteOutput' setting.
...in the middle of it and you seem to be using some aliasesDMandDAthat not only make the code harder to read but have not been specified. – PolyGeo Sep 09 '16 at 23:38