Error 000732

10483
7
11-25-2011 10:34 AM
ZarehDemirdjian
New Contributor III
When I am calling any of the tools in the Toolbox using Python
per example: AddField_management or Buffer_analysis I am getting the 000732 error saying that this feature class doesn't exist, I went and checked the feature class is there and I made sure that the path is correct ! so do you know what might cause this error ?

Many thanks,
Zareh
Tags (2)
0 Kudos
7 Replies
JamesHood
Occasional Contributor
http://support.esri.com/en/knowledgebase/techarticles/detail/35151

Cause

Most often this is due to the input data path being entered incorrectly (i.e. misspelled folder names, using backslashes instead of forward slashes)or possibly a result of having spaces in the path names.

Check the file path closely to confirm this is not the issue.

If everything is correct, it could be locked because it is in use elsewhere, so make sure its not in an MXD somewhere.  Make sure its located in a directory that you have write access to also.
0 Kudos
RuthEmerick
New Contributor II
Can you post the code that you're using? It should look something like this:

import arcpy
arcpy.AddField_management(r"C:\data\airport.gdb\schools", "ref_ID", "LONG", 9, "", "", "refcode", "NULLABLE", "REQUIRED")
0 Kudos
ZarehDemirdjian
New Contributor III
This is the code I am using:

arcpy.env.workspace = "C:\\Database\\Redlands.gdb"

inputFC = "Hospitals"
field = "Full_Address"

lstFlds = arcpy.ListFields (inputFC, field)

if len(lstFlds) ==0:
    arcpy.AddField_management(inputFC, field, "Text")
.............

I appreciate your help
0 Kudos
JamesHood
Occasional Contributor
This is the code I am using:

arcpy.env.workspace = "C:\\Database\\Redlands.gdb"

inputFC = "Hospitals"
field = "Full_Address"

lstFlds = arcpy.ListFields (inputFC, field)

if len(lstFlds) ==0:
    arcpy.AddField_management(inputFC, field, "Text")
.............

I appreciate your help




I dont know if the arcpy.env.workspace will automatically populate the featureclass with with its directory.  I think that's the problem.  You probably need to create a variable that contains the directory, or else hard code it into the featureclass string. 

I could be wrong, but this should work.   Double check tabbing , I spaced 4 but maybe you need 5?

Also, I changed the format of the directory string to clean it up a bit. 


import arcpy

arcpy.env.workspace = r"C:\Database\Redlands.gdb\"

dir = r"C:\Database\Redlands.gdb\"
inputFC = "Hospitals"
field = "Full_Address"
FC = dir + inputFC

lstFlds = arcpy.ListFields(FC, field)

if len(lstFlds) == 0:
    arcpy.AddField_management(FC, field, "Text")
    print "len = zero. Field added."
else:
    print "len does not = zero. field not added.""
0 Kudos
WayneHajas
New Contributor
I will just mention that I am having a similar problem with JoinField_management.  I am specifying data sets with the full directory names.  I have tried forward slashes and back slashes.  I have tried one and two slashes.  I have tried .shp, .dbf and no suffix.  Nothing seems to work in a python script.  I get error 000732.  I am told that  contributer.shp does not exist or is not supported.

I am able to do the JOINFIELD through the GUI.
0 Kudos
WayneHajas
New Contributor
I have something that gets rid of some 000732 errors.  I set access to readonly for the files that arcpy complained about.  My scripts are working now.

This solution does not support the degree of automation that I had hoped for - but I'm getting by.

Wayne Hajas
0 Kudos
TheoFaull
Occasional Contributor III

I had a 000732 data not supported or does not exist error. Turns out I had multiple instances of the Python IDLE GUI open and running when trying to run the script. This must create locks on the dataset. So closing the other python consoles down solved this issue for me.

ESRI need to update this error as it's currently misleading. The dataset IS supported (it was an excel spreadsheet) and the data DOES exist (trust me, it did!)