1

I am attempting to iterate through all tables in a Enterprise GDB and get all values in second column but I am getting an IOError error:

processing...
SJLU.FIRE_HYDRANT_PIPE_DIAMR_LK_MV
Traceback (most recent call last):
  File "C:/Users/bailey/Desktop/example_lookups.py", line 14, in <module>
    fieldsInTable = arcpy.ListFields(lu)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\__init__.py", line 1131, in ListFields
    return gp.listFields(dataset, wild_card, field_type)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\geoprocessing\_base.py", line 344, in listFields
    self._gp.ListFields(*gp_fixargs(args, True)))
IOError: "SJLU.FIRE_HYDRANT_PIPE_DIAMR_LK_MV" does not exist

Here is my script:

import arcpy
import os


aWS = r"C:\Users\bailey\AppData\Roaming\ESRI\Desktop10.3\ArcCatalog\Connection to GDB.sde"
arcpy.env.workspace = aWS

luList = set(arcpy.ListTables("*LK_MV") + arcpy.ListTables("*_LK"))

print "processing..."

for lu in luList:
    print lu
    fieldsInTable = arcpy.ListFields(lu)
    secondField = fieldsInTable[1].name
    print secondField

Any ideas here?

  • 1
    Does it work if you use the absolute path? – Paul Apr 4 '17 at 5:48
  • What happens if you just use the line fieldsInTable = arcpy.ListFields(r"C:\Users\bailey\AppData\Roaming\ESRI\Desktop10.3\ArcCatalog\Connection to GDB.sde\SJLU.FIRE_HYDRANT_PIPE_DIAMR_LK_MV") to refer to that table directly? – Midavalo Apr 22 '17 at 1:27
  • Also do you have permissions to view that table? – Midavalo Apr 22 '17 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.