Failed to execute. Parameters are not valid.ERROR 000732: Input Table: Dataset C:\temp\01-01.csv does not exist or is not supported ERROR 000308: Invalid field type Failed to execute (TableToDomain).
# Import system modules import arcpy from arcpy import env import os try: directory = "C:/temp/cert" os.chdir(directory) env.workspace = directory gdb = "template.gdb" extension = ".csv" # get a listing of all CSV files for myfile in os.listdir("."): if myfile.endswith(extension): #read in the domain values from the file f = open(myfile, 'r') header = f.readline().split(",") code = header[0] desc = header[1].rstrip().lstrip() f.close() del f #Set local parameters domTable = os.path.abspath(myfile) codeField = code descField = desc dWorkspace = gdb domName = myfile.split(extension)[0] #the domain takes on the name of the file, minus the ".csv" section domDesc = desc.replace("_"," ") print domTable, codeField, descField, dWorkspace, domName, domDesc print os.path.exists(domTable) arcpy.TableToDomain_management(domTable, codeField, descField, dWorkspace, domName, domDesc,"REPLACE") #f.close() except Exception, e: # If an error occurred, print line number and error message import traceback, sys tb = sys.exc_info()[2] print "Line %i" % tb.tb_lineno print e.message
It looks like your issue is that the csv file is open, and the arcpy function cannot work on the open/locked file.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.