#Julian Katz-Samuels #May 1, 2013 #Geocode addresses import arcpy arcpy.env.workplace="X:\ebruch\shared" parts=range(10) parts.remove(0) parts=map(str, parts) years=["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009"] Geocoder = r"GIS Servers\arcgis on tasks.arcgisonline.com\Locators\TA_Address_NA_10.geocodeServer" for i in years: for j in parts: address_table= r"X:\ebruch\shared\HistoryFile" + i + "_part" + j +".csv" geocode_result= r"X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFile" + i + "_part" + j arcpy.GeocodeAddresses_geocoding(address_table, Geocoder, "Address SRmailSTREETNAME VISIBLE NONE;City SRmailCITY VISIBLE NONE;State SRmailSTATE VISIBLE NONE;Zip SRmailZIP VISIBLE NONE", geocode_result, "STATIC") print "Done!"
Hi all,
I'm trying to use python to geocode a set of files, but it returns the above error after a few minutes of running the code every time. I've read that I might need to convert my files into a .dbf format, but I'm not sure. I've put my code below.#Julian Katz-Samuels #May 1, 2013 #Geocode addresses import arcpy arcpy.env.workplace="X:\ebruch\shared" parts=range(10) parts.remove(0) parts=map(str, parts) years=["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009"] Geocoder = r"GIS Servers\arcgis on tasks.arcgisonline.com\Locators\TA_Address_NA_10.geocodeServer" for i in years: for j in parts: address_table= r"X:\ebruch\shared\HistoryFile" + i + "_part" + j +".csv" geocode_result= r"X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFile" + i + "_part" + j arcpy.GeocodeAddresses_geocoding(address_table, Geocoder, "Address SRmailSTREETNAME VISIBLE NONE;City SRmailCITY VISIBLE NONE;State SRmailSTATE VISIBLE NONE;Zip SRmailZIP VISIBLE NONE", geocode_result, "STATIC") print "Done!"
Best,
Julian
>>> open(r'GIS Servers\arcgis on tasks.arcgisonline.com\Locators\TA_Address_NA_10.GeocodeServer') Runtime error <type 'exceptions.IOError'>: [Errno 2] No such file or directory: 'GIS Servers\\arcgis on tasks.arcgisonline.com\\Locators\\TA_Address_NA_10.GeocodeServer'
Hi,
Thanks for the reply. The error is that it can't find the address locator. I don't understand why this is occuring since I checked that I got the correct file path. One odd thing is that it seems to be reading the file in incorrectly. Consider the following code and error:
>>> open(r'GIS Servers\arcgis on tasks.arcgisonline.com\Locators\TA_Address_NA_10.GeocodeServer') Runtime error <type 'exceptions.IOError'>: [Errno 2] No such file or directory: 'GIS Servers\\arcgis on tasks.arcgisonline.com\\Locators\\TA_Address_NA_10.GeocodeServer'
It seems to read in too many back slashes. I have also tried to open other files on my computer in python in arcgis and it doesn't work. Could there be a problem with python in arcgis where it doesn't allow me to open other files?
Thanks,
Julian