Select to view content in your preferred language

NoneType object is not iterable

6547
12
09-18-2018 03:51 PM
JeremiahGbolagun1
New Contributor

Hi there, when I run this code in PyScripter IDE I received this error 'NoneType is not iterable'.

Can you please help to address this problem.

Regards,

import arcpy

#Set geoprocessing environments
arcpy.env.workspace = ("C:\EsriTraining\Python10_0\Data\SanJuan.gdb")
arcpy.env.overwriteOutput = True
#Create list of feature classes in SanJuan.gdb
fcList = arcpy.ListFeatureClasses()
#Create a loop to buffer Lakes and Streams
bufferList = []
for fc in fcList:
if fc == "Lakes" or fc == "Streams":
arcpy.Buffer()
arcpy.Buffer_analysis(fc, fc + "Buffer", "1000 meters")
bufferList.append(fc + "Buffer")
arcpy.Union_analysis(bufferList, "WaterBuffers")

0 Kudos
12 Replies
DanPatterson_Retired
MVP Emeritus

found it.

try just one line

import arcpy

does it error out?  It never makes it to the print statement which suggests something else

0 Kudos
DarrenWiens2
MVP Honored Contributor

What's in the previous 9 lines?

DanielJones6
New Contributor

from arcpy import env ?

0 Kudos