I'm trying to remove a join from table and a layer file and am getting the error in the subject line. Tried using "table" as the arcpy.RemoveJoin_managment() argument and got the the same error.


SeqTable = 'S:\\Shared\\RouteSmart\\CO_161_Cleanscapes\\From_Tower\\CLS_XX_Last28DaysTest.xlsx'


QV3 = "%T"
WC5 = """ '{}' LIKE '{}' """.format(QF7, QV3)

arcpy.MakeTableView_management("Join_Table", "GarbSeq", WC5)

with arcpy.da.UpdateCursor("GarbSeq", "CUSTID") as cursor:
    for row in cursor:
        row[0] = str(row[0]) + "001"

table = arcpy.JoinField_management("layerFC","Address_ID","GarbSeq","CUSTID")

with arcpy.da.UpdateCursor(table, ["Sequence", "OLDSEQUENCE"]) as cursor:
    for row in cursor:
        row[0] = row[1]


Here is the full error message:

Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 321, in RunScript
    debugger.run(codeObject, __main__.__dict__, start_stepping=1)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run
    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 654, in run
    exec cmd in globals, locals
  File "N:\Common\Script\Drivers\PrepCleanScapesUpdate.py", line 85, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 5683, in RemoveJoin
    raise e
ExecuteError: ERROR 000229: Cannot open layerFC
Failed to execute (RemoveJoin).
  • It looks like the error is coming from a much larger script that you have copy/pasted from. What happens when you run just the code that you have presented? – PolyGeo Oct 21 '16 at 22:39
  • There might be an issue with my query strings. Still getting lost with delimiters: QF2 = "Status" RV2 = 'M' WC2 = " '{}' <> '{}' ".format(QF2, RV2) arcpy.SelectLayerByAttribute_management("layerFC","ADD_TO_SELECTION",WC2) – geoJshaun Oct 21 '16 at 23:19
  • I think you need to present just a code snippet that works up to where you are stuck. – PolyGeo Oct 22 '16 at 0:05

This error was caused by using arcpy.JoinField_managment which creates a new table instead of joining tables. Therefore RemoveJoin had nothing to remove.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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