Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large list of coded domains.

They are numbers like: 01.6530.01, 05.7991.08, 05.7991.01, 05.7991.06

The code will be the exact same as the description.

I've tried to make a list using:

FRClist = [01.6530.**01**, 05.7991.08, 05.7991.01, 05.7991.06]

but it gave me a syntax error on the 01 that is bolded.

So I tried to change all the values to a string, using:

FRCstr = str(01.6530.**01**, 05.7991.08, 05.7991.01, 05.7991.06)

but it still gave me a syntax error on the same bolded 01.

In the end I hope to put the list into this:

arcpy.AddCodedValueToDomain_management(GDBpath, "FRC", FRClist[x], FRClistp[x] )

I have quite a few domains which require a lot of coded values.

share|improve this question
If by chance you already have the values in a table then you may find it easier to use the Table to Domain tool. – PolyGeo Nov 4 '12 at 22:19

In the Add Coded Value To Domain documentation there are code examples that show you how to do this. It looks like you are trying to submit a list of coded values to a function that is designed to take a coded value at a time. I think you should change your code to iterate through your list instead.

Python will not like 01.6530.01 being treated as a number because it is not a number. To treat it as a string I think you will need to use the str function on each value you add to the list rather than trying to turn the list as a whole into a string.

share|improve this answer
If you use the csv module I think they will be automatically interpreted as strings. No need to manually add quotes. – blah238 Nov 4 '12 at 22:44
Also I believe the Table to Domain tool (TableToDomain_management function in arcpy) can read a CSV file directly as the input table. You'll want to separate records in a CSV file by new lines though. So if the only column you have is your list of values, put each value on its own line. – blah238 Nov 4 '12 at 22:45
You said that you had the list in a txt file so why not use a throwaway Python script to take the values in that file and reformat with quotes or str functions onto a single line of a throwaway file that you can copy/paste into the actual script. – PolyGeo Nov 4 '12 at 23:23
Why the arbitrary restriction of no external files? This is getting pretty off-topic for this site BTW. – blah238 Nov 4 '12 at 23:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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