name cursor is not defined

12853
3
Jump to solution
04-17-2017 10:23 AM
LarryAdgate
Occasional Contributor

The following script is giving me an error message. Any ideas how to make it work and what questions I should I ask myself in the future to remedy the error.


import arcpy

fc="C:/Projects/PythonTesting/GoingPlaces.dbf"
with arcpy.da.SearchCursor(fc, ["STREETNAME"]) as Cursor:
    for row in cursor:
        print  "STREETNAME = {0}".formate(row[0])

Runtime error

Traceback (most recent call last):

File "<string>", line 7, in <module>

NameError: name 'cursor' is not defined

0 Kudos
1 Solution

Accepted Solutions
RebeccaStrauch__GISP
MVP Emeritus

Case sensitive.

  ...as Cursor:

vs your "for row in cursor:"

View solution in original post

3 Replies
RebeccaStrauch__GISP
MVP Emeritus

Case sensitive.

  ...as Cursor:

vs your "for row in cursor:"

LarryAdgate
Occasional Contributor

Thank You

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

You welcome.  Sometimes a second pair of eyes (or many in the case of geonet) helps. 

Don't forget to mark this as answered.

0 Kudos