AnsweredAssumed Answered

IndexError list out of range

Question asked by progis99 on Mar 8, 2015
Latest reply on Mar 8, 2015 by Dan_Patterson
import arcpy, sys


workspace = sys.argv[1]
featureclass = sys.argv[2]


try:
  arcpy.env.workspace = workspace
  fields = arcpy.ListFields(featureclass)
  for fld in fields:
     print fld
except:
 print arcpy.GetMessages()






 

 

The error I am getting is :

 

>>>

Traceback (most recent call last):

  File "C:\ArcpyBook\Appendix1\ListFields.py", line 3, in <module>

    workspace = sys.argv[1]

IndexError: list index out of range

>>>

Outcomes