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:
<SPAN class="comment token"># Import system modules</SPAN>
<SPAN class="keyword token">import</SPAN> sys<SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">,</SPAN> arcpy<SPAN class="punctuation token">,</SPAN> time<SPAN class="punctuation token">,</SPAN> smtplib
<SPAN class="keyword token">from</SPAN> datetime <SPAN class="keyword token">import</SPAN> date<SPAN class="punctuation token">,</SPAN> timedelta
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="comment token"># Local variables...</SPAN>
message <SPAN class="operator token">=</SPAN> <SPAN class="string token">""</SPAN>
current_time <SPAN class="operator token">=</SPAN> time<SPAN class="punctuation token">.</SPAN>asctime<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
todaysDate <SPAN class="operator token">=</SPAN> date<SPAN class="punctuation token">.</SPAN>today<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
priorYear <SPAN class="operator token">=</SPAN> str<SPAN class="punctuation token">(</SPAN>todaysDate <SPAN class="operator token">-</SPAN> timedelta<SPAN class="punctuation token">(</SPAN>days<SPAN class="operator token">=</SPAN><SPAN class="number token">547</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#547</SPAN>
starting_time <SPAN class="operator token">=</SPAN> time<SPAN class="punctuation token">.</SPAN>time<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>SetLogHistory<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>configKeyword<SPAN class="operator token">=</SPAN> <SPAN class="string token">"DEFAULTS"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>maintainAttachments <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN>
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"\\scggisis01pw\\agsfed\\data-store\\VantagePoint\\Data"</SPAN> <SPAN class="comment token">#\\scggisis01pw\\agsfed</SPAN>
coordinate_system <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\\StageDbsAE\\CoordinateSystems.gdb\\WebMercator"</SPAN>
env<SPAN class="punctuation token">.</SPAN>outputCoordinateSystem <SPAN class="operator token">=</SPAN> coordinate_system
env<SPAN class="punctuation token">.</SPAN>geographicTransformations <SPAN class="operator token">=</SPAN> <SPAN class="string token">"NAD_1983_HARN_To_WGS_1984_2"</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
outLocation <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"\\scggisis01pw\\agsfed\\data-store\\VantagePoint\\Data\\VpAnno.gdb\\VantagePointLayers"</SPAN> <SPAN class="comment token"># VantagePoint.gdb\</SPAN>
outFC <SPAN class="operator token">=</SPAN> fc<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="comment token">#neg slice for shapes, 4 from right</SPAN>
<SPAN class="comment token">#if outFC != "UtilityBilling":</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="punctuation token">(</SPAN>outLocation <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\\"</SPAN> <SPAN class="operator token">+</SPAN> outFC<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#disableFC = outLocation + "\\" + outFC</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>FeatureClassToFeatureClass_conversion<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN> outLocation<SPAN class="punctuation token">,</SPAN> outFC<SPAN class="punctuation token">)</SPAN>
message <SPAN class="operator token">=</SPAN> message <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n"</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"Added Features: "</SPAN> <SPAN class="operator token">+</SPAN> outFC
<SPAN class="comment token">#arcpy.RemoveSpatialIndex_management(disableFC)</SPAN>
<SPAN class="comment token">#arcpy.AddSpatialIndex_management(disableFC)</SPAN>
<SPAN class="comment token">#message = message + "\n" + "Handeld Indexing: " + disableFC</SPAN>
<SPAN class="comment token">#else:</SPAN>
<SPAN class="comment token"># pass</SPAN>
<SPAN class="keyword token">except</SPAN> Exception<SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token"># If an error occurred, print line number and error message</SPAN>
<SPAN class="keyword token">import</SPAN> traceback<SPAN class="punctuation token">,</SPAN> sys
tb <SPAN class="operator token">=</SPAN> sys<SPAN class="punctuation token">.</SPAN>exc_info<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN>
e <SPAN class="operator token">=</SPAN> sys<SPAN class="punctuation token">.</SPAN>exc_info<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="comment token">#print(e.args[0])</SPAN>
<SPAN class="comment token">#print "Line %i" % tb.tb_lineno</SPAN>
message <SPAN class="operator token">=</SPAN> message <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n"</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"Line %i"</SPAN> <SPAN class="operator token">%</SPAN> tb<SPAN class="punctuation token">.</SPAN>tb_lineno
message <SPAN class="operator token">=</SPAN> message <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n"</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>e<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></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><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>