AnsweredAssumed Answered

ArcGIS Pro at 2.4/arcpy- FeatureClassToFeatureClass_conversion does not honor overwriteOutput env setting

Question asked by dcoley on Aug 7, 2019
Latest reply on Nov 13, 2019 by dcoley

Hello - I upgraded to Pro to 2.4 yesterday and lo and behold my python scripts for overwriting feature classes using the FeatureClassToFeatureClass_conversion tool no longer honors the arcpy.env.overwriteOutput = True environment setting. 

 

A whole bunch of my data management scripts depend on this! 

 

The script now keeps telling me that my feature class already exists.  Of course it does, I'm doing an overwrite.  Or at least I did.

 

This was working just fine at 2.1, 2.2, 2.3.x  

I can't use Copy for most of my layers because I don't want bring over (in some cases) dozens of related tables....

 

Example:

# Import system modules
import sys, os, arcpy, time, smtplib
from datetime import date, timedelta
from arcpy import env

# Local variables...
message = ""
current_time = time.asctime()
todaysDate = date.today()
priorYear = str(todaysDate - timedelta(days=547)) #547
starting_time = time.time()
arcpy.SetLogHistory(False)
arcpy.env.configKeyword= "DEFAULTS"
arcpy.env.overwriteOutput = True
arcpy.env.maintainAttachments = False

try:
env.workspace = r"\\scggisis01pw\\agsfed\\data-store\\VantagePoint\\Data" #\\scggisis01pw\\agsfed
coordinate_system = r"C:\\StageDbsAE\\CoordinateSystems.gdb\\WebMercator"
env.outputCoordinateSystem = coordinate_system
env.geographicTransformations = "NAD_1983_HARN_To_WGS_1984_2"
for fc in arcpy.ListFeatureClasses():
outLocation = r"\\scggisis01pw\\agsfed\\data-store\\VantagePoint\\Data\\VpAnno.gdb\\VantagePointLayers" # VantagePoint.gdb\
outFC = fc[:-4] #neg slice for shapes, 4 from right
#if outFC != "UtilityBilling":
print (outLocation + "\\" + outFC)
#disableFC = outLocation + "\\" + outFC
arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, outFC)
message = message + "\n" + "Added Features: " + outFC
#arcpy.RemoveSpatialIndex_management(disableFC)
#arcpy.AddSpatialIndex_management(disableFC)
#message = message + "\n" + "Handeld Indexing: " + disableFC
#else:
# pass

except Exception:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
e = sys.exc_info()[1]
#print(e.args[0])
#print "Line %i" % tb.tb_lineno
message = message + "\n" + "Line %i" % tb.tb_lineno
message = message + "\n" + str(e)

Outcomes