<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Geocoding: Error000004 : Could not get the address fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142729#M11127</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been trying to use arcpy to geocode a set of files, but I don't know what input fields to use. If I try to manually geocode a file one at a time, one of my input fields is "Street or Intersection" and another is "City or Placename", but I'm not sure how to put these into arcpy because of the spaces. When I just put them in as below, I get the error as in the subject. How should I refer to these input fields?&amp;nbsp; Also, notice that I've tried "Address" and "City" instead and these returned the same error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;#Julian Katz-Samuels
#May 1, 2013
#Geocode addresses

import arcpy

parts=range(10)
parts.remove(0)
parts=map(str, parts)

years=["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009"]

Geocoder = r"X:\ebruch\shared\Locator\Street_Addresses_US.loc.xml"

#Check that file exists
try:
&amp;nbsp;&amp;nbsp; with open(Geocoder): pass
except IOError:
&amp;nbsp;&amp;nbsp; print 'Oh dear geocoder.'

for i in years:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for j in parts:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address_table= r"X:\ebruch\shared\HistoryFile" + i + "_part" + j +".csv"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geocode_result= r"X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFiles.gdb\GeocodedHistoryFile" + i + "_part" + j + ".shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(address_table): pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except IOError:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Oh dear address table.'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.GeocodeAddresses_geocoding(address_table, Geocoder, "Street or Intersection StreetNumStreetName VISIBLE NONE;City or Placename SRmailCITY VISIBLE NONE;State SRmailSTATE VISIBLE NONE;Zip SRmailZIP VISIBLE NONE", geocode_result, "STATIC")
print "Done!"

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Julian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Jun 2013 02:49:24 GMT</pubDate>
    <dc:creator>JulianKatz-Samuels</dc:creator>
    <dc:date>2013-06-14T02:49:24Z</dc:date>
    <item>
      <title>Geocoding: Error000004 : Could not get the address fields</title>
      <link>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142729#M11127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been trying to use arcpy to geocode a set of files, but I don't know what input fields to use. If I try to manually geocode a file one at a time, one of my input fields is "Street or Intersection" and another is "City or Placename", but I'm not sure how to put these into arcpy because of the spaces. When I just put them in as below, I get the error as in the subject. How should I refer to these input fields?&amp;nbsp; Also, notice that I've tried "Address" and "City" instead and these returned the same error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;#Julian Katz-Samuels
#May 1, 2013
#Geocode addresses

import arcpy

parts=range(10)
parts.remove(0)
parts=map(str, parts)

years=["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009"]

Geocoder = r"X:\ebruch\shared\Locator\Street_Addresses_US.loc.xml"

#Check that file exists
try:
&amp;nbsp;&amp;nbsp; with open(Geocoder): pass
except IOError:
&amp;nbsp;&amp;nbsp; print 'Oh dear geocoder.'

for i in years:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for j in parts:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address_table= r"X:\ebruch\shared\HistoryFile" + i + "_part" + j +".csv"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geocode_result= r"X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFiles.gdb\GeocodedHistoryFile" + i + "_part" + j + ".shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(address_table): pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except IOError:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Oh dear address table.'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.GeocodeAddresses_geocoding(address_table, Geocoder, "Street or Intersection StreetNumStreetName VISIBLE NONE;City or Placename SRmailCITY VISIBLE NONE;State SRmailSTATE VISIBLE NONE;Zip SRmailZIP VISIBLE NONE", geocode_result, "STATIC")
print "Done!"

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Julian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jun 2013 02:49:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142729#M11127</guid>
      <dc:creator>JulianKatz-Samuels</dc:creator>
      <dc:date>2013-06-14T02:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Geocoding: Error000004 : Could not get the address fields</title>
      <link>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142730#M11128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...maybe I'm off-base here, but is the geocoder file extension supposed to be '.loc.xml'?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jun 2013 12:12:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142730#M11128</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-06-14T12:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Geocoding: Error000004 : Could not get the address fields</title>
      <link>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142731#M11129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that you may be right, but when I change it, python no longer even finds the file... So, I don't know why that is. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Julian Katz-Samuels
#May 1, 2013
#Geocode addresses

import arcpy
from arcpy import env

parts=range(10)
parts.remove(0)
parts=map(str, parts)

years=["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009"]

env.workspace="X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFiles.gdb"
address_locator = "X:\ebruch\shared\Locator\Street_Addresses_US"

#Check that file exists
try:
&amp;nbsp;&amp;nbsp; with open(address_locator): pass
except IOError:
&amp;nbsp;&amp;nbsp; print 'Oh dear address locator.'

for i in years:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for j in parts:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address_table= "X:\ebruch\shared\HistoryFile" + i + "_part" + j +".csv"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geocode_result= "X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFiles.gdb\GeocodedHistoryFile" + i + "_part" + j + ".shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(address_table): pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except IOError:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Oh dear address table.'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.GeocodeAddresses_geocoding(address_table, address_locator, "Street or Intersection StreetNumStreetName VISIBLE NONE;City or Placename SRmailCITY VISIBLE NONE;State SRmailSTATE VISIBLE NONE;Zip SRmailZIP VISIBLE NONE", geocode_result, "STATIC")
print "Done!"

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:52:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/geocoding-error000004-could-not-get-the-address/m-p/142731#M11129</guid>
      <dc:creator>JulianKatz-Samuels</dc:creator>
      <dc:date>2021-12-11T07:52:04Z</dc:date>
    </item>
  </channel>
</rss>

