I'm doing an interface using ArcGIS and Python scripts that run at Python window.
For each time that my sript run, I need to update information, so I think that I need to delete originals tables and create news.
When I try to do this with ExcelToTable it gives me an error to add field:
arcpy.env.workspace = "F:\Otim\inter"
arcpy.Delete_management(c_re) #delete layer
c_re=arcpy.ExcelToTable_conversion("02_Rea.xlsx", "cg1_re_otim.dbf", "Rea_L")
#arcpy.env.workspace = "F:ArcGIS\Trab\Model\Result"
arcpy.AddField_management(c_re, "Name_Ba", "Text", 50, "", "", "refcode", "NULLABLE", "REQUIRED")
arcpy.AddField_management(c_re, "Longitude", "Float", "", "", "9", "", "NON_NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(c_re, "Latitude", "Float", "", "", "9", "", "NON_NULLABLE", "NON_REQUIRED", "")
ERROR 000464: Cannot get exclusive schema lock. Either being edited
or in use by another application. Failed to execute (AddField).
How can I solve this problem?
Best Answer
Try changing:
to:
The way you had it is setting your variable
c_re
to a Result object rather than a string representing a dBase file name, which is what the Add Field tool expects.