I am attempting to automate some basic geoprocessing for a web map service. I am using ArcGIS 10.1 for Desktop.

This code was built in ModelBuilder and exported to python.

This runs perfectly in ArcGIS for Desktop.

However it returns error 000732 for both the "Service_Group" dataset and the Excel sheet that are to be joined when ran Outside of Arc.

I have changed the #Local Variables to a UNC path with no luck.

    import arcpy
mxd = arcpy.mapping.MapDocument(r"X:\Mikes_Workspaces\Outage\Outage.mxd") 
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
# Script arguments
OutCurrent = arcpy.GetParameterAsText(0)
if OutCurrent == '#' or not OutCurrent:
    OutCurrent = "X:\\Geodatabases\\WebData\\Water_Service.gdb\\OutCurrent" # provide a default value if unspecified

# Local variables:
Service_Group = "Service_Group"
Update_ = "S:\\Pump and Canal Patrol\\Water On\\4-7-15\\Outage_Board.xls\\Update$"
Group_Out = "Service_Group"

# Process: Add Join
arcpy.AddJoin_management(Service_Group, "Group_", Update_, "Group_Out", "KEEP_COMMON")

# Process: Copy Features
arcpy.CopyFeatures_management(Group_Out, OutCurrent, "", "0", "0", "0")
# Process: Symbology
arcpy.ApplySymbologyFromLayer_management("OutCurrent", "X:\Mikes_Workspaces\Online Shapefiles\Outage_today.lyr") 
# Process: Remove Join
arcpy.RemoveJoin_management(Service_Group, "")

This is the error received:

    Traceback (most recent call last):
  File "C:\Python27\ArcGISx6410.1\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
    exec codeObject in __main__.__dict__
  File "E:\GIS\Mikes_Workspaces\Automation\OutageUpdate.py", line 15, in <module>
    arcpy.AddJoin_management(Service_Group, "Group_", Update_, "Group_Out", "KEEP_COMMON")
  File "C:\Program Files\ArcGIS\Server\arcpy\arcpy\management.py", line 5325, in AddJoin
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Layer Name or Table View: Dataset Service_Group does not exist or is not supported
ERROR 000732: Join Table: Dataset S:\Pump and Canal Patrol\Water On\4-7-15\Outage_Board.xls\Update$ does not exist or is not supported
Failed to execute (AddJoin).
  • 1
    Do you have the Arcmap project open when you are running this.? The error indicates the table view is not available. Is the spreadsheet loaded into the mxd ? You might investigate creating the table view yourself using arcpy.MakeTableView_management just prior to the join ? Commented Apr 21, 2015 at 15:37
  • 2
    AddJoin works on layers. Your "Group_Out" variable is pointing to a layer name and that layer doesn't exist when you run this outside of ArcMap. You'll need to create layers. See the 2nd code snippet for AddJoin here and notice how it does MakeFeatureLayer first: pro.arcgis.com/en/pro-app/tool-reference/data-management/…
    – KHibma
    Commented Apr 21, 2015 at 20:03
  • Try to avoid blanks in path names as in "S:\Pump and Canal Patrol\Water On..."
    – offermann
    Commented Jul 21, 2015 at 8:48

2 Answers 2


In addition to the advice offered as comments by others, I will also note that you will encounter an error when your script gets to:

arcpy.ApplySymbologyFromLayer_management("OutCurrent", "X:\Mikes_Workspaces\Online Shapefiles\Outage_today.lyr")

You need to present the pathname as one of the three ways below:

  • r"X:\Mikes_Workspaces\Online Shapefiles\Outage_today.lyr"
  • "X:\\Mikes_Workspaces\\Online Shapefiles\\Outage_today.lyr"
  • "X:/Mikes_Workspaces/Online Shapefiles/Outage_today.lyr"

The way you have it will give you an error.


I have experienced this problem as well, and my hunch goes like this:

  1. it only happens on machines that have both a 32-bit (for ArcGIS Desktop) and 64-bit (for ArcGIS Server) version of Python on them, and
  2. anything having to do with excel file usage only works with the 32-bit version of python

The ArcMap and ArcCatalog interactive code windows are using the 32-bit versions of python, so the script works. The system path for python is pointing to the 64-bit version, so when I run it from PyScripter or IDLE or a scheduled batch file, it fails. My solution: I thought I would have to use something like this: https://stackoverflow.com/questions/11170827/how-tell-python-script-to-use-particular-version whereby I temporarily changed the environment variables (from 64- to 32-bit python) before running my script, then afterwards changed it back (from 32- to 64-bit). But in the end, I only had to specify which python.exe to use to run my python. So at the command line (or in a batch file) I put something like this:

C:/Python27/ArcGIS10.2/python E:/scripts/my_python_script.py

and it works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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