jeudi 29 janvier 2015

Using ArcPy to Remove Join?


I am trying to remove a join in arcpy and have been all over the forums and help topics but cannot get my script to remove the join.


I have tried many combinations of inputs to the remove join but to no avail.



Name94 = "C:\\a\\b\\c\\input1.shp"
Name95 = "C:\\a\\b\\c\\input2.shp"
TablesView = "C:\\a\\b\\c\\TablesView.lyr"
arcpy.MakeFeatureLayer_management(Name94, TablesView)
arcpy.AddJoin_management(TablesView, "Buf_Units", Name95, "Units", "KEEP_ALL")
arcpy.CalculateField_management(TablesView, "Buf_Area", "[Area]", "VB", "")
arcpy.RemoveJoin_management(TablesView, "Buf_Units")


This yields the error:



ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000800: The value is not a member of | Input2.
Failed to execute (RemoveJoin).


In place of buf_units I have tried:



arcpy.RemoveJoin_management(TablesView, "'"+Name95.rstrip(".shp")+"'")
arcpy.RemoveJoin_management(TablesView)
arcpy.RemoveJoin_management(TablesView, "input2")
arcpy.RemoveJoin_management(TablesView, Name95)
arcpy.RemoveJoin_management(TablesView, "units")


The previous error is the result of most of these tries but when it is not it is:



ExecuteError: ERROR 000229: Cannot open C:\a\b\c\TablesView.lyr
Failed to execute (RemoveJoin).


I am running python 2.7, 64bit, 10.1 arcgis





Aucun commentaire:

Enregistrer un commentaire