I'm trying to create a simple join script in python from an arcgis model, where the only steps are joining a map to a table to produce a map with the table's properties. The attributes joined together are "CNTYFPID" from the shapefile map and "fips" from the textfile. I have tried editing the script produced by arcgis, but it's not working. Where am I going wrong?
# Import arcpy module
import arcpy
arcpy.env.workspace = "C:/Users/Documents/ArcGIS/Testing123.mdb"
arcpy.env.overwriteOutput = True
# Script arguments
Map = arcpy.GetParameterAsText(0)
if Map == 'tl_2009_us_county_albers_USGS.shp' or not Map:
Map = "C:/Users/Documents/ArcGIS/Python/tl_2009_us_county_albers_USGS.shp" #provide a default value if unspecified
Crosswalk = arcpy.GetParameterAsText(1)
if Crosswalk == '#' or not Crosswalk:
Crosswalk = "C:\\Users\\Documents\\ArcGIS\\Testing123.mdb\\cao_fips_crosswalk_for_gis" # provide a default value if unspecified)
# Local variables:
Map = "C:\\Users\\Documents\\ArcGIS\\geography\\tl_2009_us_county\\tl_2009_us_county_albers_USGS.shp"
Final = Map
arcpy.MakeTableView_management(Crosswalk, "fips")
#Process: Join Field
arcpy.AddMessage("Performing Join Field")
arcpy.JoinField_management(Map, "CNTYIDFP", Crosswalk, "fips", "")
The python version I am using is 2.7 and the arcgis version is 10.2. This is what it looks like in modelbuilder
Error message: "Traceback (most recent call last): File "C:/Users/Documents/ArcGIS/Yo2.py", line 28, in arcpy.MakeTableView_management(Crosswalk, "fips") File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 6306, in MakeTableView raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Table: Dataset C:\Users\Documents\ArcGIS\Testing123.mdb\cao_fips_crosswalk_for_gis does not exist or is not supported Failed to execute (MakeTableView)."