Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Sort_management in for loop

$
0
0
Hello, I like to convert tables (100+) living in access database to a geodatabase table, sorting them and deleting unnecessary fields in each table at the same time. I figured I use the Sort_management method to convert and sort the tables followed by DeleteFieldd_management method to delete the fields. Here is the code that I have written,

Code:

import arcpy

from arcpy import env

env.workspace = "E:\Database Project\ACS Estimate 2011\ACS 2011 Tables.mdb"

tableList = arcpy.ListTables()

for table in tableList:

    out_dataset = "E:\Database Project\ACS Estimate 2011\Data\To Database\Seq Tables.gdb"

    #Process: Sort
    arcpy.Sort_management(table, out_dataset, "GEOID ASCENDING", "UR")

    #Process: Delete Field
    arcpy.DeleteField_management(out_dataset, "FILEID;FILETYPE;STUSAB;CHARITER")

I am getting the following error message,
Attachment 22543
Attached Thumbnails
Click image for larger version

Name:	ErrorMessage.jpg‎
Views:	N/A
Size:	69.3 KB
ID:	22543  

Viewing all articles
Browse latest Browse all 2485

Trending Articles