I was given a list of addresses without any zip codes, and I'm trying to write a python snippet that will loop through a set of possible zip codes and make a set of geocoded shapefiles that I will later merge.
My address table is essentially laid out like this: ("Project_" fields are the possible zip codes)
Address City Project_1 Project_2 ... Project_42
123 Main Street Birmingham 78954 78953 ... 78961
My python snippet looks like this:
import arcpy
from arcpy import env
env.workspace = "N:\Reference\GIS\State\Project\Address Locator"
geocoder = env.workspace + "\State_Addresses_Create_Addr"
for y in range(1,43):
zippo = "Projects_" + str(y)
outfile = '"N:\Project_Geocode_Results_'+ str(y) + '"'
fncgeo = '"Street Apartment VISIBLE NONE; ZIP ' + zippo + ' VISIBLE"'
arcpy.GeocodeAddresses_geocoding("Geocode_Table", geocoder, fncgeo, outfile)
When I try to run the snippet outside of a loop (i.e., based on a single field), the geocode works fine. When I run it as written above, I get:
ERROR 000010: Geocode addresses failed. Failed to execute (Geocode Addresses).
Does anyone have any ideas as to why the geocode won't work in a loop?