A column was specified that does not exist

7608
1
10-10-2012 06:12 PM
by Anonymous User
Not applicable
Original User: cgraves73

Hi Everyone,

I've got a python script that keeps returning the attached error. I've researched the error and some of the threads have

suggested simple fixes such as spaces in the field heading or long file paths to the data but this is not case.

Basically the script is identifying duplicate records and placing a 1,2,3 to make these duplicate records unique (see attached).

Any assistance would be greatly appreciated.

Cheers,
Chris
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: nheick

After looking at your script, here are my comments.  I am still learning myself.

1.  Since you are not referencing any of the built-in modules, I would probably remove the first import statement for performance reasons.

2.  Looking at the function definition for SearchCursor and your error, it looks like you have the sort_fields argument where the fields argument should be.  Thus, it is looking for the field "Test A" and can't find it.  You probably just need another "" argument.

3.  I believe you will need an update cursor with a where clause that will select the record you want to update.  I believe SearchCursors are only for reading records.  You will probably want to use the OBJECTID for your where clause, or else the update cursor would probably keep updating the first record it finds in the table.  You might have 5 records with duplicate values in the field Test, where the first record gets updated up to value testvalue_5 and the other ones are still left as testvalue.


Nathan
0 Kudos