Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm writing a python script, I've got an mxd and its workspace is a geodatabase file with all the files I need into. The problem I'm encountering in testing and writing code is that, despite of the command:

arcpy.env.overwriteOutput=True

all the files contained in geodatabase fail to overwrite. There's a way to work around this?

share|improve this question
    
In ArcMap, did you check the "Overwrite the outputs of geoprocessing operations" in Geoprocessing>Geoprocessing Options? –  Baltok Oct 4 '12 at 15:25
    
yes, I did. But didn't work. –  Annalisa Minelli Oct 4 '12 at 15:43
3  
Are you aware of any schema locks on your data? That can prevent overwriting as well. File and Personal Geodatabases are particularly sensitive to this, because if one feature class has a lock, it locks the whole geodatabase. –  Baltok Oct 4 '12 at 16:03
2  
When you say that "all the files contained in the geodatabase fail to overwrite", do you mean the script fails or it completes but just does not overwrite the featureclasses which it should? –  Chad Cooper Oct 4 '12 at 16:20
    
try to run your code from a python IDE like PyScripter, then close ArcMap. –  geogeek Oct 4 '12 at 20:10

2 Answers 2

Make sure the file geodatabase is not compressed i.e., read only.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

If I recall correctly there are certain situations for which overwriteOutput won't work. In that case use the following code prior to writing out new files:

if arcpy.Exists(fileInQuestion):
    arcpy.Delete_management(fileInQuestion)

Hope that helps.

share|improve this answer
    
Thanks @egdetti, I'll try –  Annalisa Minelli Oct 5 '12 at 8:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.