I was wondering if someone could help me figure out what's going wrong with my code. It's at the very end of a code that, once a link to a geodatabase is inserted, will print the name, directory, tables, rasters, and feature classes of the geodatabase.

My problem comes with the feature class bit. For feature class, I'm supposed to also put down the field, alias and type, but it keeps popping up with the error:

IOError: "[u'Hospitals',u'Parcels',u'Roads']" does not exist

Am I missing a line somewhere?

fcList = arcpy.ListFeatureClasses("*")

fields = arcpy.ListFields(fcList)
for field in fields:

    print("Field:       {0}".format(field.name))
    print("Alias:       {0}".format(field.aliasName))
    print("Type:        {0}".format(field.type))
  • 4
    You're missing a level of nesting -- fcList is a list so you need a for fc in fcList: with ListFields on fc
    – Vince
    Feb 5, 2016 at 21:15

2 Answers 2


I know error messages have a bad vibe about them, but they really do represent an effort to explain what has gone wrong, so it's worth an effort to ask, "Well, what does that mean?"

In this case, the line of code is:

fields = arcpy.ListFields(fcList)

and the error says:

"[u'Hospitals',u'Parcels',u'Roads']" does not exist

This indicates that a list is being placed in the ListFields command, which should set off the "Uh-Oh, Forgot to Iterate!" alarm bells (Trust me: Eventually, it will). The key is to focus on where the error actually occurred, and not get distracted by your goal; if you're thinking, "Why didn't I get field properties?" when the fields haven't been extracted yet, it's going to make debugging that much more difficult.

The solution is to iterate the list of feature classes, and place each feature class in ListFields:

fcList = arcpy.ListFeatureClasses("*")

for fc in fcList:                  ## Added!
    fields = arcpy.ListFields(fc)  ## Changed!

    for field in fields:    
        print("Field:       {0}".format(field.name))
        print("Alias:       {0}".format(field.aliasName))
        print("Type:        {0}".format(field.type))

From the ListFields help you will see that the syntax for that function is:

ListFields (dataset, {wild_card}, {field_type})

The only required parameter is dataset which is explained as:

The specified feature class or table whose fields will be returned.

You received that particular error because you did not provide a feature class or table and instead provided it with a list of layer names. One layer name would have been considered a dataset but not a list of them.

If you try using any list in place of a single dataset/layer you will get the same error. For example:

import arcpy
fcList = ["a","b","c"]
fields = arcpy.ListFields(fcList)

gives this error which should look familiar:

Traceback (most recent call last):
  File "C:\Temp\test.py", line 3, in <module>
    fields = arcpy.ListFields(fcList)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\__init__.py", line 1137, in ListFields
    return gp.listFields(dataset, wild_card, field_type)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\geoprocessing\_base.py", line 344, in listFields
    self._gp.ListFields(*gp_fixargs(args, True)))
IOError: "['a', 'b', 'c']" does not exist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.