ArcPy Geocoding – ERROR 000732 Dataset Does Not Exist or Is Not Supported RematchAddresses

arcpyerror-000732geocoding

I'm trying to automate rematching addresses after another part of my script performs data scrubbing. I've attempted this process with using a variable for the input from a feature class in a SQL/SDE database and also as Feature Layer using arcpy.MakeFeatureLayer. I get the same error either way.

Here is my code:

# make table variable for input geocode address
reGeos =  arcpy.arcpy.conversion.TableToTable(addressTable, r"C:\MyDatPath", 'SSA_regeocode', Q2)

outFC = r"C:\MyDataPlaces\PRD_GIS_DB_ac.sde\PRD_GIS_DB.AC.ssaGeocode_phase1"

#geocode addresses
arcpy.geocoding.GeocodeAddresses(reGeos, loc, "'Street or Intersection' Address_line1 VISIBLE NONE;'City or Placename' City VISIBLE NONE;'ZIP Code' Zip VISIBLE NONE", outFC, "STATIC", None, '', None)

# Create values for query to be used in the rematch process (Q = query, F = field, v = value)
QF1 = "Score"
QF2 = "City"
QV1 = 85
WC = """{0} < {1} AND {2} = '{3}'""".format(QF1, QV1, QF2, QV2)
arcpy.SelectLayerByAttribute_management(outFC, "NEW_SELECTION", WC)

### This where it's bombing

arcpy.geocoding.RematchAddresses(outFC, WC)

arcpy.SelectLayerByAttribute_management(outFC, "NEW_SELECTION", """{0} < {1}""".format(QF1, QV1))
unGeoCount = int(arcpy.GetCount_management(outFC).getOutput(0))
print ("Unmatched addresses = " + str(unGeoCount))
arcpy.SelectLayerByAttribute_management(outFC, "CLEAR_SELECTION")

And here is the error:

Traceback (most recent call last):
  File "<string>", line 18, in <module>
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geocoding.py", line 601, in RematchAddresses
    raise e
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geocoding.py", line 598, in RematchAddresses
    retval = convertArcObjectToPythonObject(gp.RematchAddresses_geocoding(*gp_fixargs((in_geocoded_feature_class, in_where_clause), True)))
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
 ERROR 000732: Input Feature Class: Dataset PRD_GIS_DB.AC.ssaGeocode_phase1 does not exist or is not supported
Failed to execute (RematchAddresses).

Best Answer

Without checking all of your syntax, I think you should change:

reGeos =  arcpy.arcpy.conversion.TableToTable(addressTable, r"C:\MyDatPath", 'SSA_regeocode', Q2)

to:

arcpy.conversion.TableToTable(addressTable, r"C:\MyDatPath", 'SSA_regeocode', Q2)

At the moment the the doubling up on arcpy in the function name and creating reGeos as a Result object is bound to lead to an ERROR 000732 as soon as you try to use reGeos as if it was a table or feature class.

Related Question