Python error "ZIPCODES does not exist"

379
3
01-13-2019 07:07 PM
JeremiahGbolagun1
New Contributor

I encountered the error " ZIPCODES does not exist" when I ran below code using PyScripter. Can you please help by letting me know where I am wrong. 

import arcpy, sys
from arcpy import env

# Set the workspace environment
env.workspace = r"C:\EsriPress\GISPython\Data\SampleData.gdb"
# Check the spatial references for a feature class in the workspace
fcName = "ZIPCODES_poly"
fcNameProperties = arcpy.Describe(fcName)

print fcNameProperties.spatialReference.name

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

Is it ZIPCODES or ZIPCODES_poly that you are looking for.

Check to see if it indeed does exist by loading it up into arcmap. and examining its properties for the source, 

check its name, and the case of the text is important

0 Kudos
JeremiahGbolagun1
New Contributor

I am looking for the ZIPCODES_poly and not ZIPCODES.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Then the error message is wrong...  " ZIPCODES does not exist" , you might want to edit the post, but a restart of python and rerun the script may be in order as well