I'm new to ArcPy and Python and have a very simple question. I'm trying to write a Python script in idle
to extract the number of feature class files from a geodatabase. I can do it just fine in the console, but when I try to write a script, I get the following error:
Traceback (most recent call last):
File "C:\Users\ihb\Documents\assignmente_7.py", line 22, in <module>
for feature in fcList:
TypeError: 'NoneType' object is not iterable
Here is the code that is generating the error:
#Import arcpy and set output environments
import arcpy, sys
from arcpy import env
print "Please enter desired workspace in the 'Args' space: "
if sys.modules['idlelib']: sys.argv.extend(raw_input("Args: ").split())
workSpace = sys.argv[1]
env.workspace = workSpace
env.overwriteOutput = True
#Get Feature Classes
fcList = arcpy.ListFeatureClasses()
for feature in fcList: ### <-- **ERROR OCCURS HERE** <--####
desc = arcpy.Describe(feature)
print feature
I need to include the sys
argument so that users can specify the workspace directory.
sys.argv[1]
value is valid before using it to set the workspace.