I've been working on a python script for over a month; yesterday I upgraded to ArcGIS Pro 2.4.0 and now env.overwriteOutput no longer works, returning ERROR: 002852 Output feature class <path to fc> exists within geodatabase.
I'm using a file geodatabase; have made no changes to the script, and everything works great if I manually delete the feature classes from the geodatabase and run the script again.
I did have to create a new python clone, and reset my default editor to Spyder after the upgrade to 2.4. Am I missing something, or can others confirm this same behavior?
Solved! Go to Solution.
As an update I can get env.overwriteOutput = True to work if I use python raw string paths ie: r"c:\Path_to_data\myGDB.gdb" instead of other path treatments when setting the env.workspace environemnt setting.
I generally use a mix of paths; sometimes forward slashes, sometimes backslashes with the r prefix. Paths with backslashes and the r prefix work but no other path treatment(or at least as far as I have experimented) seems to work.
You will have to post some of your script. I have been using overwriteOutput in recent scripts that I am writing with no issues. The only things that can't be deleted are things associated/created with/by numpy arrays, but there is a workaround that I just throw in to make extra sure "out it goes,.... incoming"
if arcpy.Exists(out_fc) and arcpy.env.overwriteOutput: arcpy.Delete_management(out_fc)
The logic being, that sometimes, I don't want to overwriteOut(s) and sometimes I do. So perhaps the double checking that I do handles things magically.
You can expand that 'if' statement to include various combinations of both with 'and' and 'or' to suit your situation.
PS. Using Spyder, with Pro open at the same time if that matters.
I too have just experienced this issue. I have a basic stand alone python script that contains the arcpy.env.overwriteOutput = True statement and have been able to update my Feature Classes no problem before yesterday. I just upgraded to ArcPro 2.4 yesterday and it is giving me the Error 002852 because it says my FC already exists within the database. It should be overwriting my FC. I restarted my IDE and closed ArcPro...even restarted my computer to see if I could remove any 'locks' on my FC, but to no avail.
*Update - I reverted back to ArcPro 2.3 to have my script run again.
I am facing the same issue. I have added this arcpy.env.overwriteOutput = True statement At the start of the class and even function. I am sure it was working before now after I upgraded to ArcPro 2.4. is giving me ERROR: 002852
I just upgraded to 2.4 and this has happened to me. I was using a complex analysis script, but tested it with a simple clipping script tool that has the same behaviour.
The workaround check output conditional is tedious to implement, as every output needs to be tested. And it will add unnecessary processing time to the script
I've been using arcpy.env.overwriteOutput = True since 10.1, not sure I want to go back and amend all my scripts with a deleting check. I'd rather roll back to 2.3
I just upgraded to 2.5 and I am now having this issue. In the past I have sometimes made use of the if..delete example above, but I can not do that in this situation as I am trying to publish this as a geoprocessing service with referenced data. It appears that if you delete data when you run the script the publishing tool thinks that project data is missing. SMH.