Setting ModelBuilder to export arcpy.env.overwriteOutput = True in python

787
2
Jump to solution
05-31-2021 08:01 PM
Labels (1)
LindsayRaabe_FPCWA
Regular Contributor

I'm experimenting with the export model to python function in Model Builder. I've found that when exported, line 10 in the python script shows 

arcpy.env.overwriteOutput = False

Is there anyway in Model Builder to preset this to equal True instead? When I run the model in Model Builder, this doesn't seem to be an issue, but in the python script, if I leave it as False, the script fails to run due to what I beleive is Intermediate data that hasn't been cleared after a previous iteration. 

LindsayRaabe_FPCWA_0-1622516473194.png

 

Lindsay Raabe
Forest Products Commission WA
0 Kudos
1 Solution

Accepted Solutions
Tim_McGinnes
Occasional Contributor III

Even though overwriteOutput is an environment variable in arcpy, it is not one in ArcGIS Pro. It is an option: Options - Geoprocessing - Allow geoprocessing tools to overwrite existing datasets. Unfortunately the model export does not respect the choice from the options. I don't know of anyway to fix this.

See here for an idea somebody already raised about this:

https://community.esri.com/t5/arcgis-pro-ideas/arcgis-pro-2-5-an-option-to-overwrite-the-outputs-of-... 

View solution in original post

2 Replies
Tim_McGinnes
Occasional Contributor III

Even though overwriteOutput is an environment variable in arcpy, it is not one in ArcGIS Pro. It is an option: Options - Geoprocessing - Allow geoprocessing tools to overwrite existing datasets. Unfortunately the model export does not respect the choice from the options. I don't know of anyway to fix this.

See here for an idea somebody already raised about this:

https://community.esri.com/t5/arcgis-pro-ideas/arcgis-pro-2-5-an-option-to-overwrite-the-outputs-of-... 

LindsayRaabe_FPCWA
Regular Contributor

Thanks for the additional context. I've added my kudo to the post. 

Lindsay Raabe
Forest Products Commission WA
0 Kudos