So I ran the 'Geocode Address' tool in ArcMap and it ran fine geocoding some addresses in an excel spreadsheet. I then went to 'Geoprocessing' and then 'Results' and did a 'Copy as python snippet'. I then placed the code in the 'Python' window that can be launched from the 'Geoprocessing' menu of ArcMap, I added the needed Import and Environment information to the Python window and ran the process, which also ran fine and geocoded my addresses. However, when I include the exact same code in a file with a '.py' suffix and try to run it, it fails every time with a message of "python.exe has stopped working - A problem caused the program to stop working correctly. Please close the program."
The code I am trying to run looks like the following:
# Import system modules
from arcpy import env
env.workspace = "C:\Users\A_eric.anderson\Documents\ArcGIS\Default.gdb"
arcpy.GeocodeAddresses_geocoding(in_table="C:/Users/Public/Documents/Geocoding/Addresses_To_Geocode.xlsx.xls/Excel_Destination", address_locator="D:/StreetMapPremium_R1_2017/Locators/USA_LocalComposite", in_address_fields="Address Street VISIBLE NONE;City City VISIBLE NONE;State State VISIBLE NONE;ZIP_Code ZIPCode VISIBLE NONE", out_feature_class="C:/Users/A_eric.anderson/Documents/ArcGIS/Default.gdb/Excel_Destination_GeocodeAdd4", out_relationship_type="STATIC")
Any insight on what the problem might be, would be greatly appreciated.
- Eric -