I am writing an arcpy script and testing against a file Geodatabase. I can open the Geodatabase workspace and iterate through the "ListFeatrueClasses".
However if I try to "ListFields" I get an IO Error.
I have already tried changing the workspace directory in various ways as suggested by other posts with no success. I also made sure the file Geodatabase is fully accessible and currently its on my local drive.
This is the error:
Traceback (most recent call last): File
"C:\Users\username\Source\Repos\Python-proj1\Python-proj1\openprimegeo.
py", line 29, in
fields = arcpy.ListFields(fc1) File "C:\Program Files (x86) \ArcGIS\Desktop10.5\ArcPy\arcpy__init__.py", line 1138, in ListFields
return gp.listFields(dataset, wild_card, field_type) File "C:\Program Files
(x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\geoprocessing_bas e.py", line 346, in listFields
self._gp.ListFields(*gp_fixargs(args, True))) IOError: "Test_Polygon" does not existC:\Python27\ArcGIS10.5>
Script:
import arcpy
from arcpy import env
arcpy.env.workspace = "C:/Users/username/Downloads/prime/Prime_Template.gdb/Prime_Template.gdb"
print "starting..."
featureclasses = arcpy.ListFeatureClasses()
for fc in featureclasses:
print fc
fcList = arcpy.ListFeatureClasses()
print fcList
print "\n\n"
print "List Feature Class fields..."
print "\n\n"
for fc1 in fcList:
fields = arcpy.ListFields(fc1)
for field in fields:
print "{0} is a type of {1} with a length of {2}".format(field.name, field.type, field.length)