MCusumano

Feeding Variable into arcpy.CreateAddressLocator_geocoding

Discussion created by MCusumano on May 9, 2013
Latest reply on Jun 19, 2013 by gmohler
I have had a lot of success feeding variables into data paths for all other geoprocessing tools (this needs to be in the design so the script can be passed around different systems without modifying the code). But for this one it just will not take it.

Here is what I have:

Path = os.getcwd() + "\\"
FileGDBName = "PSEG_Land_New"
FileGDBPath = Path + FileGDBName + ".gdb"
OldFileGDBName = "PSEG_Land"
OldFileGDBPath = Path + OldFileGDBName + ".gdb"
Locator = OldFileGDBPath + "\Dashboard_Locator"
refLocator = OldFileGDBPath + "\DM_AdjustedStreet_LN_Geocoding"

primTbl = "Primary Table"

arcpy.CreateAddressLocator_geocoding("US Address - Dual Ranges", '"' + "'" + refLocator + "' " + "'" + primTbl + "'" + '"', "'Feature ID' OBJECTID VISIBLE NONE;'*From Left' L_F_F_ADD VISIBLE NONE;'*To Left' L_T_F_ADD VISIBLE NONE;'*From Right' R_F_F_ADD VISIBLE NONE;'*To Right' R_T_F_ADD VISIBLE NONE;'Prefix Direction' PREFIX VISIBLE NONE;'Prefix Type' NAMEPREFIX VISIBLE NONE;'*Street Name' NAME VISIBLE NONE;'Suffix Type' TYPE VISIBLE NONE;'Suffix Direction' SUFFIX VISIBLE NONE;'Left City or Place' L_APNAME VISIBLE NONE;'Right City or Place' R_APNAME VISIBLE NONE;'Left ZIP Code' POSTAL_L VISIBLE NONE;'Right ZIP Code' POSTAL_R VISIBLE NONE;'Left State' <None> VISIBLE NONE;'Right State' <None> VISIBLE NONE;'Left Street ID' <None> VISIBLE NONE;'Right Street ID' <None> VISIBLE NONE;'Min X value for extent' <None> VISIBLE NONE;'Max X value for extent' <None> VISIBLE NONE;'Min Y value for extent' <None> VISIBLE NONE;'Max Y value for extent' <None> VISIBLE NONE;'Left Additional Field' <None> VISIBLE NONE;'Right Additional Field' <None> VISIBLE NONE;'Altname JoinID' <None> VISIBLE NONE", Locator, "")




This gives me:

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000039: Not enough reference data tables for this style.
Failed to execute (CreateAddressLocator).

The problem is from the part where you provide the input data for the locator to be built off of. I have the syntax down perfect, if I add

print '"' + "'" + refLocator + "' " + "'" + primTbl + "'" + '"'


I get "'C:\Working Folders\GIS\Dashboard_Updates\PSEG_Land.gdb\DM_AdjustedStreet_LN_Geocoding' 'Primary Table'".

If I input this path into the piece where it takes the input, the tool will run. Completely baffled by this.

Outcomes