Currently I have a list of locations, like the following:

locations = ["Atlanta, GA", "Rochester, NY", "Paris, France"] 

I would like to geocode these locations using arcpy.geocoding.GeocodeAddresses.

This function takes in a table as the first parameter. Is there a way for me to use the Python list I have instead of making an extraneous file? Or is the only way to write the list I have into a file?

  • have you tried placing your list in the first parameter? Whats the error message – NULL.Dude Oct 3 '17 at 15:36
  • @Geo.Dude I have! It's very generic: RuntimeError: Object: Error in executing tool – tibsar Oct 3 '17 at 16:58
  • the document I provided below says its a input table, so it appears you must provide a table. you can add the code snippet create a table (csv) with your list then use that table for the geocoder. – NULL.Dude Oct 3 '17 at 19:58

You can export your python list to csv and then use that file as your input table

import csv

with open(..., 'wb') as myfile:
    wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)

Here is the documentation for that function http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002600000006000000.htm

  • I was hoping I didn't have to write an extraneous CSV file, but it seems that isn't possible. Thanks! – tibsar Oct 5 '17 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.