Esri Python for Everyone course error

426
2
02-04-2023 01:55 PM
MattFreer
New Contributor

Working on the Python for everyone course and I can not get past the first exercise. An error keeps popping up arfter I try to run the script. 

Traceback (most recent call last):
File "C:\Python27\ArcGIS10.8\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\mattf\OneDrive\Documents\ArcGIS 10.8.2\PythEveryone\RunningScripts\Oregon_Polk.gdb\SpatialRef.py", line 9, in <module>
for fc in fcList:
TypeError: 'NoneType' object is not iterable 

2 Replies
JayantaPoddar
MVP Esteemed Contributor

Try not using Onedrive folder. Instead use a local folder.

e.g. C:\EsriTraining\PythEveryone\RunningScripts\Oregon_Polk.gdb



Think Location
0 Kudos
by Anonymous User
Not applicable

That error is saying that it cannot iterate over a None, which means the fcList is not getting set to a list of featureclasses.

for fc in fcList:  #<- for fc in None

What does your code look like? The path in that error doesn't look right either. Is your script in a/the gdb?

"C:\Users\mattf\OneDrive\Documents\ArcGIS 10.8.2\PythEveryone\RunningScripts\Oregon_Polk.gdb\SpatialRef.py"

Take a look at that and either move your script out of the gdb, or fix the folder names.